added option to audio track remover to remove after a starting index

This commit is contained in:
John Andrews
2022-05-16 11:31:31 +12:00
parent 36316832aa
commit a6378ed631
2 changed files with 17 additions and 4 deletions

View File

@@ -10,17 +10,19 @@ public class FfmpegBuilderAudioTrackRemover: FfmpegBuilderNode
[Boolean(1)]
public bool RemoveAll { get; set; }
[NumberInt(2)]
public int RemoveIndex { get; set; }
[TextVariable(2)]
[TextVariable(3)]
[ConditionEquals(nameof(RemoveAll), false)]
public string Pattern { get; set; }
[Boolean(3)]
[Boolean(4)]
[ConditionEquals(nameof(RemoveAll), false)]
public bool NotMatching { get; set; }
[Boolean(4)]
[Boolean(5)]
[ConditionEquals(nameof(RemoveAll), false)]
public bool UseLanguageCode { get; set; }
@@ -29,8 +31,17 @@ public class FfmpegBuilderAudioTrackRemover: FfmpegBuilderNode
this.Init(args);
bool removing = false;
Regex? regex = null;
int index = -1;
foreach(var audio in Model.AudioStreams)
{
if (audio.Deleted == false)
{
// only record indexes of tracks that have not been deleted
++index;
if (index < RemoveIndex)
continue;
}
if (RemoveAll)
{
audio.Deleted = true;

View File

@@ -253,7 +253,9 @@
"NotMatching": "Not Matching",
"NotMatching-Help": "If audio tracks NOT matching the pattern should be removed",
"UseLanguageCode": "Use Language Code",
"UseLanguageCode-Help": "If the language code of the audio track should be used instead of the title"
"UseLanguageCode-Help": "If the language code of the audio track should be used instead of the title",
"RemoveIndex": "Remove Index",
"RemoveIndex-Help": "The start index where to remove the audio tracks from. This allows you to remove all, or all matching, audio streams after the starting index.\nSet to zero to remove all matching the parameters.\nSet to 1 to keep the first audio track and remove any after the first matching the parameters"
}
},
"FfmpegBuilderAudioTrackReorder": {