6 Commits
Author SHA1 Message Date
l4kr 08aae68525 Detect release group after bracketed metadata suffix
Naming-bot style releases like:
  Family Guy (1999) - S22E15 - Faith No More [HULU WEBDL-1080p]
  [EAC3 5.1][h264]-NTb
tack the group on with a dash right after the last metadata bracket,
rather than as a bare word ("x264-Group") or inside a trailing
parenthetical. FileSuffixTagRegex only matched the bare-word case, so
this pattern fell through untouched.

Added FileSuffixBracketDashTagRegex to catch "[bracket]-Group" at the
end of the stem, guarded by IsMetadataBracket on the bracket contents
so an ordinary hyphenated word after an unrelated bracket (e.g.
"[Interview]-Style") is never mistaken for a group suffix.
2026-07-14 11:14:59 +02:00
l4kr 89bba70ee1 Replace spacebar-to-play with double-click
Opening the selected file's default player is now triggered by
double-clicking the file queue row or a track table row, instead of
pressing Space. The Delete key still removes selected queue items.

Double-clicks on the track table's Copy checkbox column are ignored
so rapidly toggling it doesn't also launch the player.
2026-07-14 11:03:40 +02:00
l4kr 3903fd475a Fix double-tagging when file already has a release prefix
Fansub descriptor brackets like [Multiple Subtitle] or [Dual Audio]
were being misread as release group names because their individual
words didn't match any known metadata pattern. This caused a bogus
tag to be stacked in front of files that already carried their own
[Group] prefix (e.g. Erai-raws releases).

- Recognize common multi-word fansub descriptors (Multi(ple) Sub(s),
  Dual/Multi Audio, Hard/Soft sub, Uncensored/Batch/Complete, etc.)
  as metadata via whole-phrase matching in IsMetadataBracket.
- Never prepend a derived release tag when the file's own filename
  already starts with a different bracket prefix, preventing any
  tag from being stacked on top of an existing one.
2026-07-14 08:33:11 +02:00
l4kr 1348cb5394 Recognize trailing [tag] on folder, guard metadata tags
Folders that carry their release tag as a bracket at the end
(rather than a -TAG suffix or [TAG] prefix), e.g.:
  Gravity Falls 2012  Season 2 Complete + EXTRAS 720p BluRay x264 [i_c]
now have that tag ([i_c]) prepended to the episode filename.

Also fixes a real bug where a title's own hyphenated word (e.g.
"Scary-oke") could be mistaken for a "-GroupName" suffix; the word
before the dash must now itself look like quality/source/codec
metadata for that pattern to fire.

Every tag-extraction path (file dash-suffix, file trailing-parens
group, folder dash-suffix, folder bracket-suffix, folder bracket-
prefix) now also refuses to promote something that's obviously a
metadata token itself (e.g. WEB, 1080p, HDR, WEBRip) to a release
tag.
2026-07-08 11:18:01 +02:00
l4kr 3efe246a20 Extract release group from trailing (...) metadata
Amazon/streaming rips like:
  Helluva Boss (2020) - S01E01 - Murder Family (1080p AMZN WEB-DL x265 Celdra)
tuck the release group in as the last word of the closing metadata
block instead of a "-Group" suffix or its own brackets. That trailing
word is now promoted to a [Group] prefix and stripped from the
parentheses, e.g.:
  [Celdra] Helluva Boss (2020) - S01E01 - Murder Family (1080p AMZN WEB-DL x265)

Only fires when the rest of the block already looks like quality
metadata (resolution/source/codec/etc.), so unrelated parentheticals
like "(2020)" or "(Dual Audio)" are left untouched.
2026-07-08 10:59:21 +02:00
l4kr 10d7c14444 Fall back to first audio track when none preferred
Auto-selection still prefers Japanese/Chinese/undefined audio, but
if a file has none of those (e.g. only English), the first audio
track is pre-checked instead of leaving no audio track selected.
2026-07-08 10:53:48 +02:00
5 changed files with 181 additions and 34 deletions
+2 -2
View File
@@ -9,8 +9,8 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>Futonizer</AssemblyName> <AssemblyName>Futonizer</AssemblyName>
<RootNamespace>Futonizer</RootNamespace> <RootNamespace>Futonizer</RootNamespace>
<Version>1.0.6</Version> <Version>1.0.12</Version>
<FileVersion>1.0.6.0</FileVersion> <FileVersion>1.0.12.0</FileVersion>
<ApplicationIcon>Assets\app.ico</ApplicationIcon> <ApplicationIcon>Assets\app.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
+2 -1
View File
@@ -149,6 +149,7 @@
VirtualizingPanel.ScrollUnit="Pixel" VirtualizingPanel.ScrollUnit="Pixel"
PreviewMouseWheel="SmoothList_PreviewMouseWheel" PreviewMouseWheel="SmoothList_PreviewMouseWheel"
PreviewKeyDown="FileQueueList_PreviewKeyDown" PreviewKeyDown="FileQueueList_PreviewKeyDown"
MouseDoubleClick="FileQueueList_MouseDoubleClick"
ItemContainerStyle="{StaticResource QueueListBoxItemStyle}" ItemContainerStyle="{StaticResource QueueListBoxItemStyle}"
SelectionChanged="FileQueueList_SelectionChanged"> SelectionChanged="FileQueueList_SelectionChanged">
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
@@ -289,7 +290,7 @@
GridLinesVisibility="None" GridLinesVisibility="None"
VirtualizingPanel.ScrollUnit="Pixel" VirtualizingPanel.ScrollUnit="Pixel"
PreviewMouseWheel="SmoothList_PreviewMouseWheel" PreviewMouseWheel="SmoothList_PreviewMouseWheel"
PreviewKeyDown="TrackGrid_PreviewKeyDown" MouseDoubleClick="TrackGrid_MouseDoubleClick"
ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.VerticalScrollBarVisibility="Auto"> ScrollViewer.VerticalScrollBarVisibility="Auto">
<DataGrid.RowStyle> <DataGrid.RowStyle>
+28 -9
View File
@@ -519,13 +519,6 @@ public partial class MainWindow : FluentWindow
/// </summary> /// </summary>
private void FileQueueList_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) private void FileQueueList_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{ {
if (e.Key == System.Windows.Input.Key.Space)
{
OpenSelectedFileInDefaultPlayer();
e.Handled = true;
return;
}
if (e.Key != System.Windows.Input.Key.Delete) return; if (e.Key != System.Windows.Input.Key.Delete) return;
var selected = FileQueueList.SelectedItems.Cast<QueuedFileItem>().ToList(); var selected = FileQueueList.SelectedItems.Cast<QueuedFileItem>().ToList();
@@ -545,13 +538,39 @@ public partial class MainWindow : FluentWindow
/// Windows has associated with .mkv files (typically the default video /// Windows has associated with .mkv files (typically the default video
/// player), so the user can quickly preview a file without leaving the app. /// player), so the user can quickly preview a file without leaving the app.
/// </summary> /// </summary>
private void TrackGrid_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e) private void FileQueueList_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{ {
if (e.Key != System.Windows.Input.Key.Space) return;
OpenSelectedFileInDefaultPlayer(); OpenSelectedFileInDefaultPlayer();
e.Handled = true; e.Handled = true;
} }
/// <summary>
/// Same as <see cref="FileQueueList_MouseDoubleClick"/>, but for the track
/// table. Ignores double-clicks on the "Copy" checkbox column so toggling
/// it rapidly doesn't also launch the default player.
/// </summary>
private void TrackGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.OriginalSource is DependencyObject source && FindAncestor<CheckBox>(source) != null) return;
OpenSelectedFileInDefaultPlayer();
e.Handled = true;
}
/// <summary>
/// Walks up the visual tree from <paramref name="source"/> looking for an
/// ancestor (or the element itself) of type <typeparamref name="T"/>.
/// </summary>
private static T? FindAncestor<T>(DependencyObject source) where T : DependencyObject
{
var current = source;
while (current != null)
{
if (current is T typed) return typed;
current = System.Windows.Media.VisualTreeHelper.GetParent(current);
}
return null;
}
private void OpenSelectedFileInDefaultPlayer() private void OpenSelectedFileInDefaultPlayer()
{ {
if (FileQueueList.SelectedItem is not QueuedFileItem item) return; if (FileQueueList.SelectedItem is not QueuedFileItem item) return;
+138 -15
View File
@@ -14,11 +14,38 @@ public static class FileNameHelper
private static readonly Regex FolderSuffixTagRegex = private static readonly Regex FolderSuffixTagRegex =
new(@"-([A-Z][A-Z0-9]{1,7})$", RegexOptions.Compiled); new(@"-([A-Z][A-Z0-9]{1,7})$", RegexOptions.Compiled);
// Folder suffix bracket release tag: "Show Name ... x264 [i_c]" → tag = "i_c"
// A bracketed tag at the very end of the folder name (as opposed to
// PrefixTagRegex, which matches one at the start).
private static readonly Regex FolderSuffixBracketTagRegex =
new(@"\[([^\[\]]+)\]$", RegexOptions.Compiled);
// File suffix release tag: "…HEVC-DemiHuman" → tag = "DemiHuman" // File suffix release tag: "…HEVC-DemiHuman" → tag = "DemiHuman"
// Mixed case, 3-21 chars (no dots/spaces), at end of filename stem. // Mixed case, 3-21 chars (no dots/spaces), at end of filename stem.
// Min 3 chars avoids false-positives like "-v2" or "-HD". // Min 3 chars avoids false-positives like "-v2" or "-HD". The word
// immediately preceding the dash must itself be recognisable quality/
// source/codec metadata (checked by the caller via IsMetadataToken), so
// an ordinary hyphenated title word (e.g. "Scary-oke") is never mistaken
// for a "-GroupName" suffix.
private static readonly Regex FileSuffixTagRegex = private static readonly Regex FileSuffixTagRegex =
new(@"-([A-Za-z][A-Za-z0-9]{2,20})$", RegexOptions.Compiled); new(@"(?:^|[\s.])([A-Za-z0-9]+)-([A-Za-z][A-Za-z0-9]{2,20})$", RegexOptions.Compiled);
// File suffix release tag directly after a bracketed metadata block:
// "...[HULU WEBDL-1080p][EAC3 5.1][h264]-NTb" → tag = "NTb"
// Common on naming-bot-style releases that group tech specs into their
// own brackets and tack the group on with a dash at the very end. The
// bracket immediately before the dash must itself be recognisable
// metadata (checked by the caller via IsMetadataBracket), mirroring
// FileSuffixTagRegex's guard for the bare-word case.
private static readonly Regex FileSuffixBracketDashTagRegex =
new(@"\[([^\[\]]+)\]-([A-Za-z][A-Za-z0-9]{2,20})$", RegexOptions.Compiled);
// Trailing parenthesised metadata block ending in the release group as its
// last word, e.g. "... (1080p AMZN WEB-DL x265 Celdra)" → group="Celdra".
// Common on Amazon/streaming rips that don't set the group off with a
// "-" or its own brackets.
private static readonly Regex TrailingParenGroupRegex =
new(@"\(([^()]*)\)$", RegexOptions.Compiled);
// Prefix release tag: "[KAA] Show Name" → tag = "KAA" // Prefix release tag: "[KAA] Show Name" → tag = "KAA"
private static readonly Regex PrefixTagRegex = private static readonly Regex PrefixTagRegex =
@@ -45,10 +72,24 @@ public static class FileNameHelper
new(@"^(BD|BluRay|Blu-Ray|WEB|WEB-DL|WEBRip|HDTV|AMZN|NF|DSNP|HULU|MAX)$",RegexOptions.IgnoreCase | RegexOptions.Compiled), // sources new(@"^(BD|BluRay|Blu-Ray|WEB|WEB-DL|WEBRip|HDTV|AMZN|NF|DSNP|HULU|MAX)$",RegexOptions.IgnoreCase | RegexOptions.Compiled), // sources
new(@"^(Remux|Encode)$", RegexOptions.IgnoreCase | RegexOptions.Compiled), // processing new(@"^(Remux|Encode)$", RegexOptions.IgnoreCase | RegexOptions.Compiled), // processing
new(@"^(HEVC|AVC|x264|x265|H\.?264|H\.?265|VP9)$", RegexOptions.IgnoreCase | RegexOptions.Compiled), // video codecs new(@"^(HEVC|AVC|x264|x265|H\.?264|H\.?265|VP9)$", RegexOptions.IgnoreCase | RegexOptions.Compiled), // video codecs
new(@"^(FLAC|AAC|DTS|TrueHD|Atmos|AC3|EAC3|Opus|MP3)$", RegexOptions.IgnoreCase | RegexOptions.Compiled), // audio codecs new(@"^(FLAC|AAC|DTS(-HD)?|TrueHD|Atmos|E?AC3|DDP?|Opus|MP3)(\d(\.\d)?)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled), // audio codecs (+ optional channel suffix, e.g. DDP5.1)
new(@"^\d\.\d$", RegexOptions.Compiled), // bare channel count, e.g. 5.1
new(@"^(HDR|SDR|10bit|8bit|HDR10|DV|DoVi)$", RegexOptions.IgnoreCase | RegexOptions.Compiled), // HDR / bit-depth new(@"^(HDR|SDR|10bit|8bit|HDR10|DV|DoVi)$", RegexOptions.IgnoreCase | RegexOptions.Compiled), // HDR / bit-depth
]; ];
// Whole-phrase fansub/release descriptor patterns, checked against an
// entire bracket's contents rather than word-by-word. Catches common
// multi-word descriptors (e.g. "Multiple Subtitle", "Dual Audio") whose
// individual words wouldn't otherwise match any MetadataPatterns entry,
// so they'd be mistaken for a release group name.
private static readonly Regex[] DescriptorPhrasePatterns =
[
new(@"^Multi(ple)?[\s-]?Sub(s|title|titles)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled),
new(@"^(Dual|Multi)[\s-]?Audio$", RegexOptions.IgnoreCase | RegexOptions.Compiled),
new(@"^(Hard|Soft)[\s-]?sub(s)?$", RegexOptions.IgnoreCase | RegexOptions.Compiled),
new(@"^(Uncensored|Censored|Batch|Complete)$", RegexOptions.IgnoreCase | RegexOptions.Compiled),
];
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
/// <summary> /// <summary>
@@ -56,8 +97,12 @@ public static class FileNameHelper
/// (in order): /// (in order):
/// <list type="number"> /// <list type="number">
/// <item>Filename suffix tag extraction — a trailing <c>-GroupName</c> on /// <item>Filename suffix tag extraction — a trailing <c>-GroupName</c> on
/// the filename stem is stripped and promoted to a bracket prefix. /// the filename stem, a group tacked on after a bracketed metadata
/// Takes priority over any folder-derived tag.</item> /// block (e.g. <c>[h264]-NTb</c>), or a release group tucked in as
/// the last word of a trailing <c>(...)</c> metadata block (e.g.
/// Amazon rips like <c>(1080p AMZN WEB-DL x265 Celdra)</c>), is
/// stripped and promoted to a bracket prefix. Takes priority over
/// any folder-derived tag.</item>
/// <item>Show-name injection — if the (now tag-free) filename starts with /// <item>Show-name injection — if the (now tag-free) filename starts with
/// an episode code (e.g. S01E01) the show name is derived from the /// an episode code (e.g. S01E01) the show name is derived from the
/// parent folder and prepended.</item> /// parent folder and prepended.</item>
@@ -75,16 +120,63 @@ public static class FileNameHelper
string? folder = Path.GetDirectoryName(sourceFilePath); string? folder = Path.GetDirectoryName(sourceFilePath);
string folderName = string.IsNullOrEmpty(folder) ? "" : (Path.GetFileName(folder) ?? ""); string folderName = string.IsNullOrEmpty(folder) ? "" : (Path.GetFileName(folder) ?? "");
// Capture the file's own pre-existing bracket prefix (if any) before any
// transformation below, so we never stack a second/different tag on top
// of a file that already carries its own release-group prefix.
var originalPrefixMatch = PrefixTagRegex.Match(stemNoExt);
string? originalPrefixTag = originalPrefixMatch.Success ? originalPrefixMatch.Groups[1].Value : null;
// 1. Extract in-filename suffix tag and remove it from the stem. // 1. Extract in-filename suffix tag and remove it from the stem.
// e.g. "...HEVC-DemiHuman" → tag="DemiHuman", stem="...HEVC" // e.g. "...x264-DemiHuman" → tag="DemiHuman", stem="...x264"
// Only fires when the word right before the dash is itself a
// recognised metadata token (codec/source/etc.), so ordinary
// hyphenated title words are left alone.
string? fileTag = null; string? fileTag = null;
var fileSuffixMatch = FileSuffixTagRegex.Match(stemNoExt); var fileSuffixMatch = FileSuffixTagRegex.Match(stemNoExt);
if (fileSuffixMatch.Success) var bracketDashMatch = FileSuffixBracketDashTagRegex.Match(stemNoExt);
if (fileSuffixMatch.Success
&& IsMetadataToken(fileSuffixMatch.Groups[1].Value)
&& !IsMetadataToken(fileSuffixMatch.Groups[2].Value))
{ {
fileTag = fileSuffixMatch.Groups[1].Value; fileTag = fileSuffixMatch.Groups[2].Value;
stemNoExt = stemNoExt[..fileSuffixMatch.Index]; stemNoExt = stemNoExt[..(fileSuffixMatch.Groups[2].Index - 1)];
fileName = stemNoExt + ext; fileName = stemNoExt + ext;
} }
else if (bracketDashMatch.Success
&& IsMetadataBracket(bracketDashMatch.Groups[1].Value)
&& !IsMetadataToken(bracketDashMatch.Groups[2].Value))
{
// 1a. Extract a release group tacked on after a bracketed metadata
// block, e.g. "...[h264]-NTb" → tag="NTb", stem="...[h264]".
fileTag = bracketDashMatch.Groups[2].Value;
stemNoExt = stemNoExt[..(bracketDashMatch.Groups[2].Index - 1)];
fileName = stemNoExt + ext;
}
else
{
// 1b. Extract a release group tucked in as the last word of a
// trailing "(...)" metadata block, e.g.
// "... (1080p AMZN WEB-DL x265 Celdra)" → tag="Celdra",
// stem="... (1080p AMZN WEB-DL x265)".
var parenMatch = TrailingParenGroupRegex.Match(stemNoExt);
if (parenMatch.Success)
{
string parenContent = parenMatch.Groups[1].Value;
var words = parenContent.Split(' ', StringSplitOptions.RemoveEmptyEntries);
// Only treat the last word as a release group if the rest of the
// block is recognisable quality/source/codec metadata — this
// avoids misfiring on unrelated parentheticals like "(2020)" or
// "(Dual Audio)" that don't carry a group name.
if (words.Length >= 2 && !IsMetadataToken(words[^1]) && words[..^1].Any(IsMetadataToken))
{
fileTag = words[^1];
string remaining = string.Join(" ", words[..^1]);
string beforeParen = stemNoExt[..parenMatch.Index].TrimEnd();
stemNoExt = string.IsNullOrEmpty(remaining) ? beforeParen : $"{beforeParen} ({remaining})";
fileName = stemNoExt + ext;
}
}
}
// 2. Determine the release tag: filename suffix > folder tag. // 2. Determine the release tag: filename suffix > folder tag.
string? tag = fileTag; string? tag = fileTag;
@@ -122,29 +214,44 @@ public static class FileNameHelper
} }
} }
// 4. Prepend release tag if not already present. // 4. Prepend release tag if not already present. Skip when the file
// already carries its own (different) bracket prefix — never stack
// a second tag on top of an existing one.
if (!string.IsNullOrEmpty(tag)) if (!string.IsNullOrEmpty(tag))
{
bool differsFromOriginalTag = originalPrefixTag != null
&& !string.Equals(originalPrefixTag, tag, StringComparison.OrdinalIgnoreCase);
if (!differsFromOriginalTag)
{ {
string tagPrefix = $"[{tag}]"; string tagPrefix = $"[{tag}]";
if (!fileName.StartsWith(tagPrefix, StringComparison.OrdinalIgnoreCase)) if (!fileName.StartsWith(tagPrefix, StringComparison.OrdinalIgnoreCase))
fileName = tagPrefix + " " + fileName; fileName = tagPrefix + " " + fileName;
} }
}
return fileName; return fileName;
} }
/// <summary> /// <summary>
/// Extracts the release tag string (without brackets) from a folder name. /// Extracts the release tag string (without brackets) from a folder name,
/// Suffix pattern (<c>-TAG</c>) takes priority over prefix pattern /// checking (in priority order): a dash suffix (<c>-TAG</c>), a bracketed
/// (<c>[TAG]</c>). Returns <c>null</c> when neither is present. /// suffix (<c>[tag]</c> at the end), then a bracketed prefix (<c>[tag]</c>
/// at the start). Returns <c>null</c> when none are present.
/// </summary> /// </summary>
public static string? ExtractReleaseTag(string folderName) public static string? ExtractReleaseTag(string folderName)
{ {
var suffixMatch = FolderSuffixTagRegex.Match(folderName); var suffixMatch = FolderSuffixTagRegex.Match(folderName);
if (suffixMatch.Success) return suffixMatch.Groups[1].Value; if (suffixMatch.Success && !IsMetadataToken(suffixMatch.Groups[1].Value))
return suffixMatch.Groups[1].Value;
var bracketSuffixMatch = FolderSuffixBracketTagRegex.Match(folderName);
if (bracketSuffixMatch.Success && !IsMetadataBracket(bracketSuffixMatch.Groups[1].Value))
return bracketSuffixMatch.Groups[1].Value;
var prefixMatch = PrefixTagRegex.Match(folderName); var prefixMatch = PrefixTagRegex.Match(folderName);
if (prefixMatch.Success) return prefixMatch.Groups[1].Value; if (prefixMatch.Success && !IsMetadataBracket(prefixMatch.Groups[1].Value))
return prefixMatch.Groups[1].Value;
return null; return null;
} }
@@ -163,6 +270,7 @@ public static class FileNameHelper
{ {
// Strip release tags first. // Strip release tags first.
string name = FolderSuffixTagRegex.Replace(folderName, "").Trim(); string name = FolderSuffixTagRegex.Replace(folderName, "").Trim();
name = FolderSuffixBracketTagRegex.Replace(name, "").Trim();
name = PrefixTagRegex.Replace(name, "").Trim(); name = PrefixTagRegex.Replace(name, "").Trim();
// Nothing left, or what remains immediately starts with a bracket — no show name. // Nothing left, or what remains immediately starts with a bracket — no show name.
@@ -191,4 +299,19 @@ public static class FileNameHelper
if (pattern.IsMatch(token)) return true; if (pattern.IsMatch(token)) return true;
return false; return false;
} }
/// <summary>
/// True when every word inside a bracketed block is recognisable quality/
/// source/codec metadata (e.g. "[HEVC]", "[1080p-FLAC]"), meaning it's
/// just another metadata tag rather than an actual release group name
/// (e.g. "[i_c]").
/// </summary>
private static bool IsMetadataBracket(string content)
{
string trimmed = content.Trim();
if (DescriptorPhrasePatterns.Any(p => p.IsMatch(trimmed))) return true;
var parts = trimmed.Split(new[] { ' ', '-' }, StringSplitOptions.RemoveEmptyEntries);
return parts.Length > 0 && parts.All(IsMetadataToken);
}
} }
+8 -4
View File
@@ -93,9 +93,12 @@ public class MkvService
/// <summary> /// <summary>
/// Builds the list of <see cref="TrackItem"/> objects for a file. Video /// Builds the list of <see cref="TrackItem"/> objects for a file. Video
/// tracks are always pre-checked. Exactly one audio track is pre-checked: /// tracks are always pre-checked. Exactly one audio track is always
/// among Japanese/Chinese/undefined-language tracks, a stereo (2-channel) /// pre-checked: among Japanese/Chinese/undefined-language tracks, a
/// track is preferred, otherwise the first matching track in file order. /// stereo (2-channel) track is preferred, otherwise the first matching
/// track in file order. If no such track exists (e.g. only English
/// audio), the very first audio track in the file is pre-checked instead,
/// so a file is never left with no audio track selected.
/// Subtitle tracks are never pre-checked — the user picks one via the /// Subtitle tracks are never pre-checked — the user picks one via the
/// track table, and the choice propagates to other queued files. /// track table, and the choice propagates to other queued files.
/// </summary> /// </summary>
@@ -108,7 +111,8 @@ public class MkvService
.ToList(); .ToList();
MkvTrack? preferredAudio = eligibleAudio.FirstOrDefault(t => t.Properties?.AudioChannels == 2) MkvTrack? preferredAudio = eligibleAudio.FirstOrDefault(t => t.Properties?.AudioChannels == 2)
?? eligibleAudio.FirstOrDefault(); ?? eligibleAudio.FirstOrDefault()
?? audioTracks.FirstOrDefault();
var items = info.Tracks.Select(t => var items = info.Tracks.Select(t =>
{ {