Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filename format #153

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions yt-dlp-gui/Models/Lang.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public class LangMain :INotifyPropertyChanged {
[YamlMember(Order = 1203)] public string TemporaryLocale { get; set; } = "Locale";
[YamlMember(Order = 1204)] public string TemporarySystem { get; set; } = "System";
[YamlMember(Order = 1205)] public string TemporaryBrowse { get; set; } = "Browse...";
[YamlMember(Order = 1207)] public string NameFormat { get; set; } = "Name format";

//public string Formats { get; set; } = "Formats"; //Deprecated
//public string EmbedSubs { get; set; } = "Embed Subtitles";
Expand Down
4 changes: 3 additions & 1 deletion yt-dlp-gui/ViewModels/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public string OriginExt {
public bool AutoDownloadAnalysed { get; set; } = false;
public bool RememberWindowStatePosition { get; set; } = false;
public bool RememberWindowStateSize { get; set; } = false;
public string FileNameFormat { get; set; } = "%(title)s.%(ext)s";
public double Top { get; set; } = 0;
public double Left { get; set; } = 0;
public double Width { get; set; } = 600;
Expand Down Expand Up @@ -410,7 +411,8 @@ private void Config_PropertyChanged(object? sender, PropertyChangedEventArgs e)
[YamlMember(Order = 1402)] public bool SaveThumbnail { get; set; } = true;
[YamlMember(Order = 1403)] public bool UseNotifications { get; set; } = true;
[YamlMember(Order = 1404)] public bool AutoDownloadAnalysed { get; set; } = false;

[YamlMember(Order = 1405)] public string FileNameFormat { get; set; } = "%(title)s.%(ext)s";

[Description("Last Checking Update Date")]
[YamlMember(Order = 9001)] public string LastVersion { get; set; } = string.Empty;
[YamlMember(Order = 9002)] public string LastCheckUpdate { get; set; } = string.Empty;
Expand Down
30 changes: 21 additions & 9 deletions yt-dlp-gui/Views/Main.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -697,19 +697,21 @@
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<!-- 0 -->
<RowDefinition/>
<RowDefinition Height="Auto"/>
<!-- 1 -->
<RowDefinition/>
<RowDefinition Height="Auto"/>
<!-- 2 -->
<RowDefinition/>
<RowDefinition Height="Auto"/>
<!-- 3 -->
<RowDefinition/>
<RowDefinition Height="Auto"/>
<!-- 4 -->
<RowDefinition/>
<!-- 5 -->
<RowDefinition/>
<RowDefinition Height="Auto"/>
<!-- 6 -->
<RowDefinition/>
<RowDefinition Height="Auto"/>
<!-- 7 -->
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!--Notifications-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -->
<TextBlock Grid.Row="0" Text="{Binding Source={x:Static app:App.Lang}, Path=Main.Notifications}" HorizontalAlignment="Right" VerticalAlignment="Center"/>
Expand Down Expand Up @@ -764,16 +766,26 @@
<Grid Grid.Row="6" Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="25"/>
<ColumnDefinition Width="15"/>
</Grid.ColumnDefinitions>
<controls:TextEditor IsReadOnly="True" Text="{Binding PathTEMP}" Margin="0" Multiline="False" VerticalAlignment="Center"/>
<ToggleButton Grid.Column="1" Focusable="False" Margin="2,0,0,0" Checked="ToggleButton_Checked">
<controls:TextEditor IsReadOnly="True" Text="{Binding PathTEMP}" Margin="0,0,25,0" Multiline="False" VerticalAlignment="Center" Grid.ColumnSpan="2"/>
<ToggleButton Grid.Column="1" Focusable="False" Margin="2,0,0,0" Checked="ToggleButton_Checked" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal" Margin="4,0,0,0">
<controls:Icons Size="14" Kind="FolderSettings"/>
<controls:Icons Kind="MenuDown" Size="16"/>
</StackPanel>
</ToggleButton>
</Grid>
<!--Name format-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ -->
<TextBlock Grid.Row="7" Margin="0,5,0,5" Text="{Binding Source={x:Static app:App.Lang}, Path=Main.NameFormat}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<Grid Grid.Row="7" Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controls:TextEditor IsReadOnly="False" Text="{Binding FileNameFormat}" Margin="0,2,0,0" Multiline="False" VerticalAlignment="Center"/>
</Grid>
</Grid>
</TabItem>
</TabControl>
Expand Down
2 changes: 1 addition & 1 deletion yt-dlp-gui/Views/Main.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private void GetInfo() {
if (!string.IsNullOrWhiteSpace(Data.selectedConfig.file)) {
dlp.LoadConfig(Data.selectedConfig.file);
}
if (Data.UseOutput) dlp.Output("%(title)s.%(ext)s"); //if not used config, default template
if (Data.UseOutput) dlp.Output(Data.FileNameFormat); //if not used config, default template
ClearStatus();
dlp.Exec(null, std => {
//取得JSON
Expand Down