mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-31 03:00:18 -06:00
fixing issue deleting source directory
This commit is contained in:
@@ -59,19 +59,19 @@ namespace FileFlows.BasicNodes.File
|
||||
{
|
||||
args.Logger?.ILog("Checking directory to delete: " + path);
|
||||
DirectoryInfo dir = new DirectoryInfo(path);
|
||||
if (dir.Parent.FullName.ToLower() == root.ToLower())
|
||||
if (dir.FullName.ToLower() == root.ToLower())
|
||||
{
|
||||
args.Logger?.ILog("At root, stopping deleting: " + root);
|
||||
return 1;
|
||||
}
|
||||
if (dir.Parent.FullName.Length <= root.Length)
|
||||
if (dir.FullName.Length <= root.Length)
|
||||
{
|
||||
args.Logger?.ILog("At root2, stopping deleting: " + root);
|
||||
return 1;
|
||||
}
|
||||
if (deleteSubFolders == false && dir.GetDirectories().Any())
|
||||
{
|
||||
args.Logger?.ILog("Directory is contains subfolders, cannot delete: " + dir.FullName);
|
||||
args.Logger?.ILog("Directory contains subfolders, cannot delete: " + dir.FullName);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -466,6 +466,52 @@ return 1;
|
||||
Assert.AreEqual(1, result);
|
||||
Assert.AreEqual("hevc_qsv -preset slow -tune film -global_quality 19 -look_ahead 1", args.Variables["VideoCodecParameters"]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Function_FFMPEG()
|
||||
{
|
||||
Function pm = new Function();
|
||||
var logger = new TestLogger();
|
||||
var args = new FileFlows.Plugin.NodeParameters(@"D:\videos\unprocessed\dummy.mkv", logger, false, string.Empty);
|
||||
args.GetToolPathActual = (string name) => @"C:\utils\ffmpeg\ffmpeg.exe";
|
||||
args.TempPath = @"D:\videos\temp";
|
||||
pm.Code = @"
|
||||
let output = Flow.TempPath + '/' + Flow.NewGuid() + '.mkv';
|
||||
let ffmpeg = Flow.GetToolPath('ffmpeg');
|
||||
let process = Flow.Execute({
|
||||
command: ffmpeg,
|
||||
argumentList: [
|
||||
'-i',
|
||||
Variables.file.FullName,
|
||||
'-c:v',
|
||||
'libx265',
|
||||
'-c:a:1',
|
||||
'aac',
|
||||
'-ac',
|
||||
'2',
|
||||
'-filter:a:0',
|
||||
'""acompressor = ratio = 4""',
|
||||
|
||||
output
|
||||
]
|
||||
});
|
||||
|
||||
if(process.standardOutput)
|
||||
Logger.ILog('Standard output: ' + process.standardOutput);
|
||||
if(process.starndardError)
|
||||
Logger.ILog('Standard error: ' + process.starndardError);
|
||||
|
||||
if(process.exitCode !== 0){
|
||||
Logger.ELog('Failed processing ffmpeg: ' + process.exitCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
Flow.SetWorkingFile(output);
|
||||
return 1;
|
||||
; ";
|
||||
var result = pm.Execute(args);
|
||||
Assert.AreEqual(1, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace VideoNodes.Tests
|
||||
|
||||
AudioNormalization node = new();
|
||||
node.AllAudio = true;
|
||||
node.Pattern = "commentary";
|
||||
node.Pattern = "";
|
||||
node.NotMatching = true;
|
||||
//node.OutputFile = file + ".sup";
|
||||
var args = new FileFlows.Plugin.NodeParameters(file, logger, false, string.Empty);
|
||||
@@ -81,6 +81,58 @@ namespace VideoNodes.Tests
|
||||
string log = logger.ToString();
|
||||
Assert.AreEqual(1, output);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AudioNormalization_Pattern_Test3()
|
||||
{
|
||||
const string file = @"D:\videos\unprocessed\test_orig.mkv";
|
||||
var logger = new TestLogger();
|
||||
var vi = new VideoInfoHelper(@"C:\utils\ffmpeg\ffmpeg.exe", logger);
|
||||
var vii = vi.Read(file);
|
||||
|
||||
const string ffmpeg = @"C:\utils\ffmpeg\ffmpeg.exe";
|
||||
|
||||
AudioNormalization node = new();
|
||||
node.AllAudio = true;
|
||||
node.Pattern = "flac";
|
||||
node.NotMatching = false;
|
||||
//node.OutputFile = file + ".sup";
|
||||
var args = new FileFlows.Plugin.NodeParameters(file, logger, false, string.Empty);
|
||||
args.GetToolPathActual = (string tool) => ffmpeg;
|
||||
args.TempPath = @"D:\videos\temp";
|
||||
|
||||
new VideoFile().Execute(args);
|
||||
|
||||
int output = node.Execute(args);
|
||||
string log = logger.ToString();
|
||||
Assert.AreEqual(2, output);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AudioNormalization_Pattern_Test4()
|
||||
{
|
||||
const string file = @"D:\videos\unprocessed\test_orig.mkv";
|
||||
var logger = new TestLogger();
|
||||
var vi = new VideoInfoHelper(@"C:\utils\ffmpeg\ffmpeg.exe", logger);
|
||||
var vii = vi.Read(file);
|
||||
|
||||
const string ffmpeg = @"C:\utils\ffmpeg\ffmpeg.exe";
|
||||
|
||||
AudioNormalization node = new();
|
||||
node.AllAudio = true;
|
||||
//node.Pattern = "truehd";
|
||||
//node.NotMatching = false;
|
||||
//node.OutputFile = file + ".sup";
|
||||
var args = new FileFlows.Plugin.NodeParameters(file, logger, false, string.Empty);
|
||||
args.GetToolPathActual = (string tool) => ffmpeg;
|
||||
args.TempPath = @"D:\videos\temp";
|
||||
|
||||
new VideoFile().Execute(args);
|
||||
|
||||
int output = node.Execute(args);
|
||||
string log = logger.ToString();
|
||||
Assert.AreEqual(1, output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace VideoNodes.Tests
|
||||
using System.Threading.Tasks;
|
||||
|
||||
[TestClass]
|
||||
public class AudoTrackRemovalTests
|
||||
public class AudioTrackRemovalTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void AudoTrackRemoval_Test_01()
|
||||
Reference in New Issue
Block a user