diff --git a/BasicNodes/BasicNodes.csproj b/BasicNodes/BasicNodes.csproj index 1cce421f..c30939c7 100644 Binary files a/BasicNodes/BasicNodes.csproj and b/BasicNodes/BasicNodes.csproj differ diff --git a/BasicNodes/File/MoveFile.cs b/BasicNodes/File/MoveFile.cs index 7d5a7bd6..e0d8b4c5 100644 --- a/BasicNodes/File/MoveFile.cs +++ b/BasicNodes/File/MoveFile.cs @@ -37,7 +37,16 @@ namespace FileFlows.BasicNodes.File else dest = Path.Combine(dest, new FileInfo(args.FileName).Name); - var destDir = new FileInfo(dest).DirectoryName; + + var fiDest = new FileInfo(dest); + var fiWorkingFile = new FileInfo(args.WorkingFile); + if (fiDest.Extension != fiWorkingFile.Extension) + { + dest = dest.Replace(fiDest.Extension, fiWorkingFile.Extension); + fiDest = new FileInfo(dest); + } + + var destDir = fiDest.DirectoryName; if (Directory.Exists(destDir) == false) Directory.CreateDirectory(destDir); @@ -50,6 +59,7 @@ namespace FileFlows.BasicNodes.File { if (System.IO.File.Exists(dest)) System.IO.File.Delete(dest); + args.Logger.ILog($"Moving file: \"{args.WorkingFile}\" to \"{dest}\""); System.IO.File.Move(args.WorkingFile, dest, true); if (DeleteOriginal && args.WorkingFile != args.FileName) @@ -68,7 +78,6 @@ namespace FileFlows.BasicNodes.File while (task.IsCompleted == false) { - long currentSize = 0; var destFileInfo = new FileInfo(dest); if (destFileInfo.Exists) diff --git a/Builds/BasicNodes.zip b/Builds/BasicNodes.zip index a36f973f..30118e6d 100644 Binary files a/Builds/BasicNodes.zip and b/Builds/BasicNodes.zip differ diff --git a/Builds/VideoNodes.zip b/Builds/VideoNodes.zip index 20d30e9f..6a970344 100644 Binary files a/Builds/VideoNodes.zip and b/Builds/VideoNodes.zip differ diff --git a/VideoNodes/EncodingNode.cs b/VideoNodes/EncodingNode.cs index ce35754e..e62af9a2 100644 --- a/VideoNodes/EncodingNode.cs +++ b/VideoNodes/EncodingNode.cs @@ -18,18 +18,22 @@ namespace FileFlows.VideoNodes private FFMpegEncoder Encoder; - protected bool Encode(NodeParameters args, string ffmpegExe, string ffmpegParameters) + protected bool Encode(NodeParameters args, string ffmpegExe, string ffmpegParameters, string extension = "mkv", string outputFile = "") { + if (string.IsNullOrEmpty(extension)) + extension = "mkv"; + this.args = args; Encoder = new FFMpegEncoder(ffmpegExe, args.Logger); Encoder.AtTime += AtTimeEvent; - string output = Path.Combine(args.TempPath, Guid.NewGuid().ToString() + ".mkv"); - args.Logger.DLog("New Temp file: " + output); + if (string.IsNullOrEmpty(outputFile)) + outputFile = Path.Combine(args.TempPath, Guid.NewGuid().ToString() + "." + extension); - bool success = Encoder.Encode(args.WorkingFile, output, ffmpegParameters); + bool success = Encoder.Encode(args.WorkingFile, outputFile, ffmpegParameters); + args.Logger.ILog("Encoding succesful: " + success); if (success) - args.SetWorkingFile(output); + args.SetWorkingFile(outputFile); Encoder.AtTime -= AtTimeEvent; Encoder = null; return success; diff --git a/VideoNodes/FFMPEG.cs b/VideoNodes/FFMPEG.cs index 000809ad..612e25be 100644 --- a/VideoNodes/FFMPEG.cs +++ b/VideoNodes/FFMPEG.cs @@ -12,6 +12,10 @@ namespace FileFlows.VideoNodes [TextArea(1)] public string CommandLine { get; set; } + [DefaultValue("mkv")] + [Text(2)] + public string Extension { get; set; } + public override string Icon => "far fa-file-video"; private NodeParameters args; @@ -34,8 +38,14 @@ namespace FileFlows.VideoNodes if (string.IsNullOrEmpty(ffmpegExe)) return -1; + if (string.IsNullOrEmpty(Extension)) + Extension = "mkv"; + + string outputFile = Path.Combine(args.TempPath, Guid.NewGuid().ToString() + "." + Extension); + string cmd = CommandLine.Replace("{WorkingFile}", "\"" + args.WorkingFile + "\"") - .Replace("{TempDir}", "\"" + args.TempPath + Path.DirectorySeparatorChar + "\""); + .Replace("{Output}", outputFile) + .Replace("{output}", outputFile); if (Encode(args, ffmpegExe, CommandLine) == false) return -1; diff --git a/VideoNodes/VideoEncode.cs b/VideoNodes/VideoEncode.cs index 00654153..87ad1260 100644 --- a/VideoNodes/VideoEncode.cs +++ b/VideoNodes/VideoEncode.cs @@ -24,6 +24,10 @@ namespace FileFlows.VideoNodes [Text(4)] public string Language { get; set; } + [DefaultValue("mkv")] + [Text(5)] + public string Extension { get; set; } + public override string Icon => "far fa-file-video"; private NodeParameters args; @@ -122,7 +126,7 @@ namespace FileFlows.VideoNodes string ffArgsLine = string.Join(" ", ffArgs); - if (Encode(args, ffmpegExe, ffArgsLine) == false) + if (Encode(args, ffmpegExe, ffArgsLine, Extension) == false) return -1; return 1; diff --git a/VideoNodes/VideoNodes.csproj b/VideoNodes/VideoNodes.csproj index ede7f28b..f5e9a387 100644 Binary files a/VideoNodes/VideoNodes.csproj and b/VideoNodes/VideoNodes.csproj differ diff --git a/VideoNodes/VideoNodes.en.json b/VideoNodes/VideoNodes.en.json index 94d7995a..3b1116b5 100644 --- a/VideoNodes/VideoNodes.en.json +++ b/VideoNodes/VideoNodes.en.json @@ -17,6 +17,8 @@ "VideoEncode":{ "Description":"A generic video encoding node, this lets you customize how to encode a video file using ffmpeg.\n\nOutput 1: Video was processed\nOutput 2: No processing required", "Fields":{ + "Extension":"Extension", + "Extension-Help":"The file extension to use on the newly created file", "VideoCodec":"Video Codec", "VideoCodec-Help":"The video codec the video should be in, for example hevc, h264", "VideoCodecParameters":"Video Codec Parameters", @@ -43,8 +45,10 @@ "FFMPEG":{ "Description":"The node lets you run any FFMPEG command you like. Giving you full control over what it can do.\n\nFor more information refer to the FFMPEG documentation", "Fields":{ + "Extension":"Extension", + "Extension-Help":"The file extension to use on the newly created file", "CommandLine":"Command Line", - "CommandLine-Help":"The command line to run with FFMPEG.\n'{WorkingFile}': the working file of the flow\n'{TempDir}': The temp directory, including trailing directory separator, where files are generally created during the flow." + "CommandLine-Help":"The command line to run with FFMPEG.\n'{WorkingFile}': the working file of the flow\n'{Output}': The output file that will be passed as the last parameter to FFMPEG including the extension defined above." } } } diff --git a/buildplugins.ps1 b/buildplugins.ps1 index ca87c310..c3cf585a 100644 --- a/buildplugins.ps1 +++ b/buildplugins.ps1 @@ -2,7 +2,6 @@ Remove-Item Builds -Recurse -ErrorAction SilentlyContinue $revision = (git rev-list --count --first-parent HEAD) -join "`n" - $json = "[`n" Get-ChildItem -Path .\ -Filter *.csproj -Recurse -File -Name | ForEach-Object { @@ -21,7 +20,11 @@ Get-ChildItem -Path .\ -Filter *.csproj -Recurse -File -Name | ForEach-Object { $json += "`t},`n" # build an instance for FileFlow local code - # dotnet build $_ /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary --output:../FileFlows/Server/Plugins + dotnet build $_ /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary --output:../FileFlows/Server/Plugins/$name/$version + Remove-Item ../FileFlows/Server/Plugins/$name/$version/Plugin.dll -ErrorAction SilentlyContinue + Remove-Item ../FileFlows/Server/Plugins/$name/$version/*.deps.json -ErrorAction SilentlyContinue + Remove-Item ../FileFlows/Server/Plugins/$name/$version/ref -Recurse -ErrorAction SilentlyContinue + # build instance to be published to repo dotnet build $_ /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary --output:Builds/$name @@ -37,7 +40,3 @@ $json = $json.Substring(0, $json.lastIndexOf(',')) + "`n" $json += ']'; Set-Content -Path 'plugins.json' -Value $json - -Remove-Item ../FileFlows/Server/Plugins/Plugin.dll -ErrorAction SilentlyContinue -Remove-Item ../FileFlows/Server/Plugins/*.deps.json -ErrorAction SilentlyContinue -Remove-Item ../FileFlows/Server/Plugins/ref -Recurse -ErrorAction SilentlyContinue diff --git a/plugins.json b/plugins.json index d384989c..683b1734 100644 --- a/plugins.json +++ b/plugins.json @@ -1,12 +1,12 @@ [ { "Name": "BasicNodes", - "Version": "0.0.1.2", + "Version": "0.0.1.3", "Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/BasicNodes.zip?raw=true" }, { "Name": "VideoNodes", - "Version": "0.0.1.2", + "Version": "0.0.1.3", "Package": "https://github.com/revenz/FileFlowsPlugins/blob/master/Builds/VideoNodes.zip?raw=true" } ]