diff --git a/VideoNodes/VideoNodes.csproj b/VideoNodes/VideoNodes.csproj index 4c123bf0..a456479e 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 97d40eea..eeb020e4 100644 --- a/VideoNodes/VideoNodes.en.json +++ b/VideoNodes/VideoNodes.en.json @@ -135,7 +135,9 @@ "Language": "Language", "Language-Help": "The ISO 639-2 language code to use. \nhttps://en.wikipedia.org/wiki/List_of_ISO_639-2_codes", "OutputFile": "Output File", - "OutputFile-Help": "Where to save the the output file to, e.g. \"'{folder.Orig.FullName}\\{file.Orig.FileName}.srt'\" to save it with the original file as a srt output.\nIf left blank an srt subtitle will be created in the same folder as the original input file." + "OutputFile-Help": "Where to save the the output file to, e.g. \"'{folder.Orig.FullName}\\{file.Orig.FileName}.srt'\" to save it with the original file as a srt output.\nIf left blank an srt subtitle will be created in the same folder as the original input file.", + "SetWorkingFile": "Set as Working File", + "SetWorkingFile-Help": "When this is checked, if a subtitle is extracted, the working file will be changed to this extracted subtitle. The original working file will NOT be deleted." } }, "VideoCodec": { diff --git a/VideoNodes/VideoNodes/SubtitleExtractor.cs b/VideoNodes/VideoNodes/SubtitleExtractor.cs index ad3c8424..aeb6048f 100644 --- a/VideoNodes/VideoNodes/SubtitleExtractor.cs +++ b/VideoNodes/VideoNodes/SubtitleExtractor.cs @@ -19,6 +19,18 @@ [File(2)] public string OutputFile { get; set; } + [Boolean(3)] + public bool SetWorkingFile { get; set; } + private Dictionary _Variables; + public override Dictionary Variables => _Variables; + public SubtitleExtractor() + { + _Variables = new Dictionary() + { + { "sub.FileName", "/path/to/subtitle.sub" } + }; + } + public override int Execute(NodeParameters args) { try @@ -88,6 +100,13 @@ if (result.ExitCode == 0) { + args.UpdateVariables(new Dictionary + { + { "sub.FileName", OutputFile } + }); + if (SetWorkingFile) + args.SetWorkingFile(OutputFile, dontDelete: true); + return 1; }