Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08aae68525 | ||
|
|
89bba70ee1 |
+2
-2
@@ -9,8 +9,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AssemblyName>Futonizer</AssemblyName>
|
||||
<RootNamespace>Futonizer</RootNamespace>
|
||||
<Version>1.0.10</Version>
|
||||
<FileVersion>1.0.10.0</FileVersion>
|
||||
<Version>1.0.12</Version>
|
||||
<FileVersion>1.0.12.0</FileVersion>
|
||||
<ApplicationIcon>Assets\app.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
+2
-1
@@ -149,6 +149,7 @@
|
||||
VirtualizingPanel.ScrollUnit="Pixel"
|
||||
PreviewMouseWheel="SmoothList_PreviewMouseWheel"
|
||||
PreviewKeyDown="FileQueueList_PreviewKeyDown"
|
||||
MouseDoubleClick="FileQueueList_MouseDoubleClick"
|
||||
ItemContainerStyle="{StaticResource QueueListBoxItemStyle}"
|
||||
SelectionChanged="FileQueueList_SelectionChanged">
|
||||
<ListBox.ItemTemplate>
|
||||
@@ -289,7 +290,7 @@
|
||||
GridLinesVisibility="None"
|
||||
VirtualizingPanel.ScrollUnit="Pixel"
|
||||
PreviewMouseWheel="SmoothList_PreviewMouseWheel"
|
||||
PreviewKeyDown="TrackGrid_PreviewKeyDown"
|
||||
MouseDoubleClick="TrackGrid_MouseDoubleClick"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto">
|
||||
<DataGrid.RowStyle>
|
||||
|
||||
+28
-9
@@ -519,13 +519,6 @@ public partial class MainWindow : FluentWindow
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
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
|
||||
/// player), so the user can quickly preview a file without leaving the app.
|
||||
/// </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();
|
||||
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()
|
||||
{
|
||||
if (FileQueueList.SelectedItem is not QueuedFileItem item) return;
|
||||
|
||||
@@ -30,6 +30,16 @@ public static class FileNameHelper
|
||||
private static readonly Regex FileSuffixTagRegex =
|
||||
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
|
||||
@@ -87,10 +97,12 @@ public static class FileNameHelper
|
||||
/// (in order):
|
||||
/// <list type="number">
|
||||
/// <item>Filename suffix tag extraction — a trailing <c>-GroupName</c> on
|
||||
/// the filename stem, 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>
|
||||
/// the filename stem, a group tacked on after a bracketed metadata
|
||||
/// 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
|
||||
/// an episode code (e.g. S01E01) the show name is derived from the
|
||||
/// parent folder and prepended.</item>
|
||||
@@ -121,6 +133,7 @@ public static class FileNameHelper
|
||||
// hyphenated title words are left alone.
|
||||
string? fileTag = null;
|
||||
var fileSuffixMatch = FileSuffixTagRegex.Match(stemNoExt);
|
||||
var bracketDashMatch = FileSuffixBracketDashTagRegex.Match(stemNoExt);
|
||||
if (fileSuffixMatch.Success
|
||||
&& IsMetadataToken(fileSuffixMatch.Groups[1].Value)
|
||||
&& !IsMetadataToken(fileSuffixMatch.Groups[2].Value))
|
||||
@@ -129,6 +142,16 @@ public static class FileNameHelper
|
||||
stemNoExt = stemNoExt[..(fileSuffixMatch.Groups[2].Index - 1)];
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user