mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-05-06 08:49:25 -05:00
renamed ffmpeg builder set audio language to set language and now does subtitles as well as audio
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -4,26 +4,65 @@ namespace FileFlows.VideoNodes.FfmpegBuilderNodes;
|
||||
|
||||
public class FfmpegBuilderAudioSetLanguage : FfmpegBuilderNode
|
||||
{
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/video-nodes/ffmpeg-builder/audio-set-language";
|
||||
public override string HelpUrl => "https://docs.fileflows.com/plugins/video-nodes/ffmpeg-builder/set-language";
|
||||
|
||||
public override int Outputs => 2;
|
||||
|
||||
public override string Icon => "fas fa-comment-dots";
|
||||
|
||||
|
||||
[Select(nameof(StreamTypeOptions), 1)]
|
||||
public string StreamType { get; set; }
|
||||
|
||||
[Required]
|
||||
[Text(1)]
|
||||
[Text(2)]
|
||||
public string Language { get; set; }
|
||||
|
||||
private static List<ListOption> _StreamTypeOptions;
|
||||
public static List<ListOption> StreamTypeOptions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_StreamTypeOptions == null)
|
||||
{
|
||||
_StreamTypeOptions = new List<ListOption>
|
||||
{
|
||||
new ListOption { Label = "Audio", Value = "Audio" },
|
||||
new ListOption { Label = "Subtitle", Value = "Subtitle" },
|
||||
new ListOption { Label = "Both", Value = "Both" },
|
||||
};
|
||||
}
|
||||
return _StreamTypeOptions;
|
||||
}
|
||||
}
|
||||
|
||||
public override int Execute(NodeParameters args)
|
||||
{
|
||||
bool changes = false;
|
||||
foreach (var at in Model.AudioStreams)
|
||||
if (StreamType == "Subtitle" || StreamType == "Both")
|
||||
{
|
||||
if (string.IsNullOrEmpty(at.Language))
|
||||
|
||||
foreach (var at in Model.AudioStreams)
|
||||
{
|
||||
at.Language = Language.ToLower();
|
||||
at.ForcedChange = true; // this will ensure the language is set even if there are no changes anywhere else
|
||||
changes = true;
|
||||
if (string.IsNullOrEmpty(at.Language))
|
||||
{
|
||||
at.Language = Language.ToLower();
|
||||
at.ForcedChange = true; // this will ensure the language is set even if there are no changes anywhere else
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(string.IsNullOrEmpty(StreamType) || StreamType == "Both" || StreamType == "Audio")
|
||||
{
|
||||
foreach (var at in Model.AudioStreams)
|
||||
{
|
||||
if (string.IsNullOrEmpty(at.Language))
|
||||
{
|
||||
at.Language = Language.ToLower();
|
||||
at.ForcedChange = true; // this will ensure the language is set even if there are no changes anywhere else
|
||||
changes = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return changes ? 1 : 2;
|
||||
|
||||
Binary file not shown.
@@ -292,15 +292,17 @@
|
||||
}
|
||||
},
|
||||
"FfmpegBuilderAudioSetLanguage": {
|
||||
"Label": "FFMPEG Builder: Audio Set Language",
|
||||
"Label": "FFMPEG Builder: Set Language",
|
||||
"Outputs": {
|
||||
"1": "Audio tracks updated in FFMPEG Builder",
|
||||
"2": "Audio tracks NOT updated"
|
||||
"1": "Tracks updated in FFMPEG Builder",
|
||||
"2": "Tracks NOT updated"
|
||||
},
|
||||
"Description": "Allows you to set the language for any audio tracks that have no language set. If the audio track does have a language set, it will be skipped.\n\nOutput 1: Audio Tracks were updated\nOutput 2: No audio tracks were needing to be updated",
|
||||
"Description": "Allows you to set the language for any tracks that have no language set. If the track does have a language set, it will be skipped.\n\nOutput 1: Tracks were updated\nOutput 2: No tracks were needing to be updated",
|
||||
"Fields": {
|
||||
"StreamType": "Type",
|
||||
"StreamType-Help": "The type of track to set the language for",
|
||||
"Language": "Language",
|
||||
"Language-Help": "Optional ISO 639-2 language code to use. Will attempt to find an audio track with this language code if not the best audio track will be used.\nhttps://en.wikipedia.org/wiki/List_of_ISO_639-2_codes"
|
||||
"Language-Help": "The ISO 639-2 language code to use.\nhttps://en.wikipedia.org/wiki/List_of_ISO_639-2_codes"
|
||||
}
|
||||
},
|
||||
"FfmpegBuilderAutoChapters": {
|
||||
|
||||
Reference in New Issue
Block a user