Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3efe246a20 | ||
|
|
10d7c14444 |
+2
-2
@@ -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.8</Version>
|
||||||
<FileVersion>1.0.6.0</FileVersion>
|
<FileVersion>1.0.8.0</FileVersion>
|
||||||
<ApplicationIcon>Assets\app.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\app.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,13 @@ public static class FileNameHelper
|
|||||||
private static readonly Regex FileSuffixTagRegex =
|
private static readonly Regex FileSuffixTagRegex =
|
||||||
new(@"-([A-Za-z][A-Za-z0-9]{2,20})$", RegexOptions.Compiled);
|
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 =
|
||||||
new(@"^\[(.+?)\]", RegexOptions.Compiled);
|
new(@"^\[(.+?)\]", RegexOptions.Compiled);
|
||||||
@@ -45,7 +52,8 @@ 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
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -56,8 +64,10 @@ 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, or a release group tucked in as the last word
|
||||||
/// Takes priority over any folder-derived tag.</item>
|
/// 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>
|
||||||
@@ -85,6 +95,31 @@ public static class FileNameHelper
|
|||||||
stemNoExt = stemNoExt[..fileSuffixMatch.Index];
|
stemNoExt = stemNoExt[..fileSuffixMatch.Index];
|
||||||
fileName = stemNoExt + ext;
|
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;
|
||||||
|
|||||||
@@ -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 =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user