Bump version to 1.0.3
- Suffix release tag support: folder name ending in -TAG prepends [TAG] to output filenames - Show name injection from parent folder for episode-only filenames (e.g. S01E01-Name.mkv) - Queue and logs display predicted output filename - Run button label reflects rename when applicable - Gray out main UI while strip/rename is in progress
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows;
|
||||
using Futonizer.Models;
|
||||
using Futonizer.Services;
|
||||
@@ -111,28 +110,6 @@ public partial class ProgressWindow : FluentWindow
|
||||
TotalBytesText.Text = $"{doneMb:F0} / {totalMb:F0} MB copied";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the source file's parent folder starts with a bracketed tag
|
||||
/// (e.g. "[KAA]" or "[neoHEVC]") and the file name doesn't already
|
||||
/// start with that tag, returns the file name with the tag prepended
|
||||
/// (e.g. "[KAA] episode.mkv"). Otherwise returns the file name unchanged.
|
||||
/// Only applied to the output file — the source is never touched.
|
||||
/// </summary>
|
||||
private static string PrefixedFileName(string sourceFilePath, string fileName)
|
||||
{
|
||||
string? folder = Path.GetDirectoryName(sourceFilePath);
|
||||
if (string.IsNullOrEmpty(folder)) return fileName;
|
||||
|
||||
string folderName = Path.GetFileName(folder);
|
||||
var match = Regex.Match(folderName, @"^\[.+?\]");
|
||||
if (!match.Success) return fileName;
|
||||
|
||||
string prefix = match.Value + " "; // e.g. "[KAA] "
|
||||
if (fileName.StartsWith(match.Value, StringComparison.Ordinal)) return fileName;
|
||||
|
||||
return prefix + fileName;
|
||||
}
|
||||
|
||||
private static long SafeFileLength(string path)
|
||||
{
|
||||
try { return new FileInfo(path).Length; }
|
||||
@@ -167,7 +144,8 @@ public partial class ProgressWindow : FluentWindow
|
||||
{
|
||||
await semaphore.WaitAsync(ct);
|
||||
|
||||
var job = new JobProgressItem { FileName = file.FileName, FileSizeBytes = SafeFileLength(file.FilePath) };
|
||||
string computedFileName = FileNameHelper.ComputeOutputFileName(file.FilePath);
|
||||
var job = new JobProgressItem { FileName = computedFileName, FileSizeBytes = SafeFileLength(file.FilePath) };
|
||||
job.PropertyChanged += (_, args) =>
|
||||
{
|
||||
if (args.PropertyName == nameof(JobProgressItem.MegabytesPerSecond))
|
||||
@@ -180,9 +158,11 @@ public partial class ProgressWindow : FluentWindow
|
||||
|
||||
try
|
||||
{
|
||||
string sourceDir = Path.GetDirectoryName(file.FilePath) ?? "";
|
||||
|
||||
string outputFilePath = overwritingInPlace
|
||||
? file.FilePath
|
||||
: Path.Combine(_outputFolder, PrefixedFileName(file.FilePath, file.FileName));
|
||||
? Path.Combine(sourceDir, computedFileName)
|
||||
: Path.Combine(_outputFolder, computedFileName);
|
||||
|
||||
var videoIds = file.Tracks
|
||||
.Where(t => t.Type == "video" && t.Copy)
|
||||
@@ -210,7 +190,7 @@ public partial class ProgressWindow : FluentWindow
|
||||
progress, ct);
|
||||
|
||||
string tag = result.Success ? "[DONE]" : "[FAIL]";
|
||||
AppendLog($"{tag} {result.FileName} — {result.Message}");
|
||||
AppendLog($"{tag} {Path.GetFileName(result.OutputFilePath)} — {result.Message}");
|
||||
|
||||
HistoryService.Add(new HistoryEntry
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user