Match and mux in dropped external subtitles
Drag in subtitle files alongside .mkv files and they're matched to the right video by episode code (S04E06, zero-padding and separator insensitive, plus 4x06 as a fallback) and muxed in as extra subtitle tracks. Any subtitle format mkvmerge accepts is recognized: SRT, (S)SA, VobSub, WebVTT, PGS/SUP, USF, SAMI, TTML/DFXP, STL, Kate. Matching works regardless of drop order — subtitles dropped before their video are held pending until a matching video shows up, and vice versa. Language, forced, and SDH flags are guessed from common filename tokens (e.g. "eng", "forced", "sdh") to set the muxed track's language/name/flags; unmatched subtitles are reported in the status bar.
This commit is contained in:
+63
-3
@@ -137,7 +137,7 @@
|
||||
<Grid Grid.Row="1">
|
||||
<TextBlock x:Name="DropHint"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Text="Drop .mkv files onto this window"
|
||||
Text="Drop .mkv files (and subtitles) onto this window"
|
||||
Opacity="0.4" FontSize="14" TextAlignment="Center"
|
||||
IsHitTestVisible="False"/>
|
||||
|
||||
@@ -158,6 +158,7 @@
|
||||
<ColumnDefinition Width="16"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="18"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
@@ -179,12 +180,21 @@
|
||||
FontSize="12" VerticalAlignment="Center" Margin="6,0"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Text="{Binding FileSizeDisplay}"
|
||||
<Border Grid.Column="2" CornerRadius="8" Padding="5,1" Margin="2,0"
|
||||
VerticalAlignment="Center"
|
||||
Background="{DynamicResource AccentFillColorSecondaryBrush}"
|
||||
Visibility="{Binding HasExternalSubtitles, Converter={StaticResource BoolToVis}}"
|
||||
ToolTip="{Binding ExternalSubtitlesTooltip}">
|
||||
<TextBlock Text="{Binding ExternalSubtitles.Count, StringFormat={}+{0} sub}"
|
||||
FontSize="9" FontWeight="SemiBold"/>
|
||||
</Border>
|
||||
|
||||
<TextBlock Grid.Column="3" Text="{Binding FileSizeDisplay}"
|
||||
FontSize="11" VerticalAlignment="Center" Margin="4,0"
|
||||
Opacity="0.6"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"/>
|
||||
|
||||
<Button Grid.Column="3" Content="×"
|
||||
<Button Grid.Column="4" Content="×"
|
||||
Tag="{Binding}"
|
||||
Click="RemoveFile_Click"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
@@ -209,6 +219,55 @@
|
||||
BorderBrush="{DynamicResource ControlElevationBorderBrush}"
|
||||
BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- External subtitles matched to the selected file -->
|
||||
<Border x:Name="ExternalSubsPanel" Grid.Row="0" Margin="10,8,10,0"
|
||||
Padding="8,6" CornerRadius="6" Visibility="Collapsed"
|
||||
Background="{DynamicResource ControlFillColorSecondaryBrush}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="External subtitles to mux in" FontSize="11"
|
||||
FontWeight="SemiBold" Opacity="0.7" Margin="0,0,0,4"/>
|
||||
<ItemsControl x:Name="ExternalSubsList">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Background="{DynamicResource ControlFillColorDefaultBrush}"
|
||||
BorderBrush="{DynamicResource ControlElevationBorderBrush}"
|
||||
BorderThickness="1" CornerRadius="4"
|
||||
Margin="0,0,6,6" Padding="6,3">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding LanguageDisplay}" FontSize="11"
|
||||
FontWeight="SemiBold" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding FileName}" FontSize="11" Opacity="0.6"
|
||||
Margin="6,0,0,0" VerticalAlignment="Center"
|
||||
MaxWidth="220" TextTrimming="CharacterEllipsis"/>
|
||||
<TextBlock Text="DEFAULT" FontSize="9" FontWeight="Bold"
|
||||
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
|
||||
Margin="6,0,0,0" VerticalAlignment="Center"
|
||||
Visibility="{Binding IsDefault, Converter={StaticResource BoolToVis}}"/>
|
||||
<Button Content="×" Tag="{Binding}"
|
||||
Click="RemoveExternalSubtitle_Click"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
Padding="6,0,0,0" Cursor="Hand" FontSize="13"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<TextBlock x:Name="NoSelectionHint"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Text="Select a file to view its tracks"
|
||||
@@ -328,6 +387,7 @@
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user