Initial commit: Futonizer MKV track stripper

This commit is contained in:
l4kr
2026-07-04 00:43:37 +02:00
commit 1208cadc3b
25 changed files with 2629 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace Futonizer.Models;
/// <summary>
/// Represents one track of a queued MKV file, as shown in the track table.
/// The <see cref="Copy"/> property is user-editable and drives which tracks
/// are passed to mkvmerge when stripping.
/// </summary>
public class TrackItem : INotifyPropertyChanged
{
private bool _copy;
public int Id { get; init; }
public string Type { get; init; } = string.Empty;
public string Codec { get; init; } = string.Empty;
public string Language { get; init; } = string.Empty;
public string Name { get; init; } = string.Empty;
public bool ForcedDisplay { get; init; }
private bool _defaultTrack;
/// <summary>
/// Whether this track should be flagged as the default track of its type
/// when stripped. For subtitles this is kept in sync with <see cref="Copy"/>
/// (selecting a subtitle also makes it the default one).
/// </summary>
public bool DefaultTrack
{
get => _defaultTrack;
set
{
if (_defaultTrack == value) return;
_defaultTrack = value;
OnPropertyChanged();
}
}
/// <summary>
/// Text shown in the track table's Name column. Subtitle tracks are shown
/// as "Codec/Name" so tracks that share a display name but use a different
/// codec are easy to tell apart.
/// </summary>
public string DisplayName => Type == "subtitles" ? $"{Codec}/{Name}" : Name;
public bool Copy
{
get => _copy;
set
{
if (_copy == value) return;
_copy = value;
OnPropertyChanged();
}
}
/// <summary>
/// Key used to match subtitle tracks with the same identity across different
/// queued files when propagating a subtitle selection. Subtitles are matched
/// on "Codec/Name" so tracks with the same name but a different codec are
/// treated as distinct.
/// </summary>
public string PropagationKey => DisplayName;
public event PropertyChangedEventHandler? PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string? name = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}