Skip to content

Commit

Permalink
Add preferred quality selector to the mass downloaders (#955)
Browse files Browse the repository at this point in the history
* Add preferred quality combobox to WindowQueueOptions

* Update translations

* Cleanup

* Adjust margin
  • Loading branch information
ScrubN authored Jan 23, 2024
1 parent 78ef070 commit e3eb1a5
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 7 deletions.
9 changes: 9 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -815,4 +815,7 @@
<value>Open folder
</value>
</data>
<data name="PreferredQuality" xml:space="preserve">
<value>Preferred Quality:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -813,4 +813,7 @@
<data name="ContextMenuOpenTaskFolder" xml:space="preserve">
<value>Open folder</value>
</data>
<data name="PreferredQuality" xml:space="preserve">
<value>Qualité préférée:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.it.resx
Original file line number Diff line number Diff line change
Expand Up @@ -815,4 +815,7 @@
<value>Open folder
</value>
</data>
<data name="PreferredQuality" xml:space="preserve">
<value>Preferred Quality:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.pl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -813,4 +813,7 @@
<data name="ContextMenuOpenTaskFolder" xml:space="preserve">
<value>Open folder</value>
</data>
<data name="PreferredQuality" xml:space="preserve">
<value>Preferred Quality:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -812,4 +812,7 @@
<data name="ContextMenuOpenTaskFolder" xml:space="preserve">
<value>Open folder</value>
</data>
<data name="PreferredQuality" xml:space="preserve">
<value>Preferred Quality:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.ru.resx
Original file line number Diff line number Diff line change
Expand Up @@ -813,4 +813,7 @@
<data name="ContextMenuOpenTaskFolder" xml:space="preserve">
<value>Open folder</value>
</data>
<data name="PreferredQuality" xml:space="preserve">
<value>Preferred Quality:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.tr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -814,4 +814,7 @@
<data name="ContextMenuOpenTaskFolder" xml:space="preserve">
<value>Open folder</value>
</data>
<data name="PreferredQuality" xml:space="preserve">
<value>Preferred Quality:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.uk.resx
Original file line number Diff line number Diff line change
Expand Up @@ -813,4 +813,7 @@
<data name="ContextMenuOpenTaskFolder" xml:space="preserve">
<value>Open folder</value>
</data>
<data name="PreferredQuality" xml:space="preserve">
<value>Preferred Quality:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions TwitchDownloaderWPF/Translations/Strings.zh.resx
Original file line number Diff line number Diff line change
Expand Up @@ -812,4 +812,7 @@
<data name="ContextMenuOpenTaskFolder" xml:space="preserve">
<value>Open folder</value>
</data>
<data name="PreferredQuality" xml:space="preserve">
<value>Preferred Quality:</value>
</data>
</root>
25 changes: 19 additions & 6 deletions TwitchDownloaderWPF/WindowQueueOptions.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
lex:ResxLocalizationProvider.DefaultAssembly="TwitchDownloaderWPF"
lex:ResxLocalizationProvider.DefaultDictionary="Strings"
mc:Ignorable="d"
Title="Queue Options" MinHeight="240" Height="240" MinWidth="500" Width="500" Loaded="Window_loaded">
Title="Queue Options" MinHeight="280" Height="280" MinWidth="500" Width="500" Loaded="Window_loaded">
<Window.Resources>
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="behave:TextBoxTripleClickBehavior.TripleClickSelectLine" Value="True" />
Expand All @@ -33,21 +33,34 @@
<TextBox x:Name="textFolder" HorizontalAlignment="Left" Height="23" Margin="3,0,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" MinWidth="300" Background="{DynamicResource AppElementBackground}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
<Button x:Name="btnFolder" Content="{lex:Loc Browse}" HorizontalAlignment="Left" Margin="3,0,0,0" VerticalAlignment="Top" MinWidth="60" Click="btnFolder_Click" Background="{DynamicResource ActionButtonBackground}" Foreground="{DynamicResource ActionButtonText}" BorderBrush="{DynamicResource ActionButtonBorder}"/>
</WrapPanel>
<CheckBox x:Name="checkVideo" Content="{lex:Loc DownloadVideo}" HorizontalAlignment="Left" Margin="0,8,0,0" VerticalAlignment="Top" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
<CheckBox x:Name="checkVideo" Content="{lex:Loc DownloadVideo}" HorizontalAlignment="Left" Margin="0,8,0,0" VerticalAlignment="Top" Checked="CheckVideo_OnChecked" Unchecked="CheckVideo_OnChecked" Foreground="{DynamicResource AppText}" BorderBrush="{DynamicResource AppElementBorder}"/>
<StackPanel Orientation="Horizontal" Margin="20,5,0,0">
<TextBlock x:Name="TextPreferredQuality" Text="{lex:Loc PreferredQuality}" HorizontalAlignment="Right" Margin="5,5,0,0" Foreground="{DynamicResource AppTextDisabled}" />
<ComboBox SelectedIndex="0" x:Name="ComboPreferredQuality" IsEnabled="False" Margin="5,0,0,0" MinWidth="90" Background="{DynamicResource AppElementBackground}" Foreground="{DynamicResource AppText}" BorderBrush="{DynamicResource AppElementBorder}">
<ComboBoxItem Content="Source" />
<ComboBoxItem Content="1440p" />
<ComboBoxItem Content="1080p" />
<ComboBoxItem Content="720p" />
<ComboBoxItem Content="480p" />
<ComboBoxItem Content="360p" />
<ComboBoxItem Content="160p" />
<ComboBoxItem Content="144p" />
</ComboBox>
</StackPanel>
<CheckBox x:Name="checkChat" Content="{lex:Loc DownloadChat}" HorizontalAlignment="Left" Margin="0,8,0,0" VerticalAlignment="Top" Checked="checkChat_Checked" Unchecked="checkChat_Unchecked" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="20,5,0,0" Visibility="Visible">
<StackPanel Margin="20,0,0,0">
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="TextDownloadFormat" Text="{lex:Loc DownloadFormat}" IsEnabled="False" Margin="5,0,0,0" Foreground="{DynamicResource AppTextDisabled}"/>
<RadioButton x:Name="radioJson" IsEnabled="False" IsChecked="True" Content="JSON" HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Top" Checked="radioJson_Checked" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
<RadioButton x:Name="radioTxt" IsEnabled="False" Content="TXT" HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Top" Checked="radioTxt_Checked" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
<RadioButton x:Name="radioHTML" IsEnabled="False" Content="HTML" HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Top" Checked="radioHTML_Checked" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
</StackPanel>
<StackPanel x:Name="StackChatCompression" Orientation="Horizontal" Margin="20,5,0,0">
<StackPanel x:Name="StackChatCompression" Orientation="Horizontal" Margin="0,5,0,0">
<TextBlock x:Name="TextCompression" Text="{lex:Loc ChatCompression}" Margin="5,0,0,0" Foreground="{DynamicResource AppTextDisabled}"/>
<RadioButton x:Name="RadioCompressionNone" IsEnabled="False" IsChecked="True" Content="{lex:Loc ChatCompressionNone}" HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Top" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
<RadioButton x:Name="RadioCompressionGzip" IsEnabled="False" Content="{lex:Loc ChatCompressionGzip}" HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Top" Background="{DynamicResource AppRadio}" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
</StackPanel>
<CheckBox x:Name="checkEmbed" IsEnabled="False" Content="{lex:Loc EmbedImages}" HorizontalAlignment="Left" Margin="25,5,0,0" VerticalAlignment="Top" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
<CheckBox x:Name="checkEmbed" IsEnabled="False" Content="{lex:Loc EmbedImages}" HorizontalAlignment="Left" Margin="5,5,0,0" VerticalAlignment="Top" Foreground="{DynamicResource AppText}" BorderBrush="{DynamicResource AppElementBorder}"/>
</StackPanel>
<CheckBox x:Name="checkRender" IsEnabled="False" Content="{lex:Loc RenderChat}" HorizontalAlignment="Left" Margin="0,8,0,0" VerticalAlignment="Top" BorderBrush="{DynamicResource AppElementBorder}" Foreground="{DynamicResource AppText}"/>
<Button x:Name="btnQueue" Content="{lex:Loc AddToQueue}" HorizontalAlignment="Left" Margin="182,-18,0,0" VerticalAlignment="Top" MinWidth="105" Height="45" Click="btnQueue_Click" Background="{DynamicResource ActionButtonBackground}" Foreground="{DynamicResource ActionButtonText}" BorderBrush="{DynamicResource ActionButtonBorder}"/>
Expand Down
20 changes: 19 additions & 1 deletion TwitchDownloaderWPF/WindowQueueOptions.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using TwitchDownloaderCore.Chat;
using TwitchDownloaderCore.Options;
using TwitchDownloaderCore.Tools;
using TwitchDownloaderWPF.Properties;
Expand Down Expand Up @@ -33,6 +32,9 @@ public WindowQueueOptions(Page page)
if (Directory.Exists(queueFolder))
textFolder.Text = queueFolder;

TextPreferredQuality.Visibility = Visibility.Collapsed;
ComboPreferredQuality.Visibility = Visibility.Collapsed;

if (page is PageVodDownload or PageClipDownload)
{
checkVideo.IsChecked = true;
Expand Down Expand Up @@ -463,6 +465,7 @@ private void EnqueueDataList()
Oauth = Settings.Default.OAuth,
TempFolder = Settings.Default.TempPath,
Id = int.Parse(taskData.Id),
Quality = (ComboPreferredQuality.SelectedItem as ComboBoxItem)?.Content as string,
FfmpegPath = "ffmpeg",
CropBeginning = false,
CropEnding = false,
Expand Down Expand Up @@ -497,6 +500,7 @@ private void EnqueueDataList()
ClipDownloadOptions downloadOptions = new ClipDownloadOptions
{
Id = taskData.Id,
Quality = (ComboPreferredQuality.SelectedItem as ComboBoxItem)?.Content as string,
Filename = Path.Combine(folderPath, FilenameService.GetFilename(Settings.Default.TemplateClip, taskData.Title, taskData.Id, taskData.Time, taskData.Streamer,
TimeSpan.Zero, TimeSpan.FromSeconds(taskData.Length), taskData.Views.ToString(), taskData.Game) + ".mp4"),
ThrottleKib = Settings.Default.DownloadThrottleEnabled
Expand Down Expand Up @@ -683,5 +687,19 @@ private void Window_loaded(object sender, RoutedEventArgs e)
Title = Translations.Strings.TitleEnqueueOptions;
App.RequestTitleBarChange();
}

private void CheckVideo_OnChecked(object sender, RoutedEventArgs e)
{
if (this.IsInitialized)
{
ComboPreferredQuality.IsEnabled = checkVideo.IsChecked.GetValueOrDefault();
try
{
var newBrush = (Brush)Application.Current.Resources[checkVideo.IsChecked.GetValueOrDefault() ? "AppText" : "AppTextDisabled"];
TextPreferredQuality.Foreground = newBrush;
}
catch { /* Ignored */ }
}
}
}
}

0 comments on commit e3eb1a5

Please sign in to comment.