mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-31 06:09:39 -06:00
added option to subtitle extractor to set working file
This commit is contained in:
Binary file not shown.
@@ -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": {
|
||||
|
||||
@@ -19,6 +19,18 @@
|
||||
[File(2)]
|
||||
public string OutputFile { get; set; }
|
||||
|
||||
[Boolean(3)]
|
||||
public bool SetWorkingFile { get; set; }
|
||||
private Dictionary<string, object> _Variables;
|
||||
public override Dictionary<string, object> Variables => _Variables;
|
||||
public SubtitleExtractor()
|
||||
{
|
||||
_Variables = new Dictionary<string, object>()
|
||||
{
|
||||
{ "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<string, object>
|
||||
{
|
||||
{ "sub.FileName", OutputFile }
|
||||
});
|
||||
if (SetWorkingFile)
|
||||
args.SetWorkingFile(OutputFile, dontDelete: true);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user