twitch settings added, settings images dictionary added

This commit is contained in:
2024-03-04 19:31:48 +01:00
Unverified
parent 3210b1b14b
commit 930b13eecc
11 changed files with 220 additions and 3 deletions

View File

@@ -120,4 +120,37 @@
<data name="Header.Text" xml:space="preserve">
<value>Settings</value>
</data>
<data name="SearchingHeader.Text" xml:space="preserve">
<value>Searching</value>
</data>
<data name="SearchingPlaylistCount.Description" xml:space="preserve">
<value>0 = Get all</value>
</data>
<data name="SearchingPlaylistCount.Header" xml:space="preserve">
<value>Default number of videos fetched from playlist</value>
</data>
<data name="TwitchHeader.Text" xml:space="preserve">
<value>Twitch</value>
</data>
<data name="TwitchVodChunkDownloadingErrorRetry.Header" xml:space="preserve">
<value>Retry when downloading single VOD chunk fails</value>
</data>
<data name="TwitchVodChunkDownloadingErrorRetryCount.Header" xml:space="preserve">
<value>Number of retries</value>
</data>
<data name="TwitchVodChunkDownloadingErrorRetryDelay.Header" xml:space="preserve">
<value>Time between fail and retry (in miliseconds)</value>
</data>
<data name="TwitchVodParallelDownloads.Description" xml:space="preserve">
<value>WARNING: Too many chunks downloaded at once may cause performance problems</value>
</data>
<data name="TwitchVodParallelDownloads.Header" xml:space="preserve">
<value>Maximum number of VOD chunks downloaded in parallel</value>
</data>
<data name="TwitchVodPassiveTrimming.Description" xml:space="preserve">
<value>Only chunks from trim start to trim end range will be downloaded</value>
</data>
<data name="TwitchVodPassiveTrimming.Header" xml:space="preserve">
<value>VOD passive trimming</value>
</data>
</root>

View File

@@ -149,7 +149,7 @@ namespace VDownload.Core.ViewModels.Home
OptionBarPlaylistSearchButtonChecked = false;
OptionBarSearchNotPending = true;
OptionBarVideoSearchTBValue = string.Empty;
OptionBarPlaylistSearchNBValue = _settingsService.Data.Common.MaxNumberOfVideosToGetFromPlaylist;
OptionBarPlaylistSearchNBValue = _settingsService.Data.Common.Searching.MaxNumberOfVideosToGetFromPlaylist;
OptionBarPlaylistSearchTBValue = string.Empty;
}

View File

@@ -4,10 +4,82 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VDownload.Services.Data.Settings;
namespace VDownload.Core.ViewModels.Settings
{
public class SettingsViewModel : ObservableObject
{
#region SERVICES
protected readonly ISettingsService _settingsService;
#endregion
#region PROPERTIES
public int SearchingPlaylistCount
{
get => _settingsService.Data.Common.Searching.MaxNumberOfVideosToGetFromPlaylist;
set => SetProperty(_settingsService.Data.Common.Searching.MaxNumberOfVideosToGetFromPlaylist, value, _settingsService.Data.Common.Searching, (u, n) => u.MaxNumberOfVideosToGetFromPlaylist = n);
}
public bool TwitchVodPassiveTrimming
{
get => _settingsService.Data.Twitch.Vod.PassiveTrimming;
set => SetProperty(_settingsService.Data.Twitch.Vod.PassiveTrimming, value, _settingsService.Data.Twitch.Vod, (u, n) => u.PassiveTrimming = n);
}
public int TwitchVodParallelDownloads
{
get => _settingsService.Data.Twitch.Vod.MaxNumberOfParallelDownloads;
set => SetProperty(_settingsService.Data.Twitch.Vod.MaxNumberOfParallelDownloads, value, _settingsService.Data.Twitch.Vod, (u, n) => u.MaxNumberOfParallelDownloads = n);
}
public bool TwitchVodChunkDownloadingErrorRetry
{
get => _settingsService.Data.Twitch.Vod.ChunkDownloadingError.Retry;
set => SetProperty(_settingsService.Data.Twitch.Vod.ChunkDownloadingError.Retry, value, _settingsService.Data.Twitch.Vod.ChunkDownloadingError, (u, n) => u.Retry = n);
}
public int TwitchVodChunkDownloadingErrorRetryCount
{
get => _settingsService.Data.Twitch.Vod.ChunkDownloadingError.RetriesCount;
set => SetProperty(_settingsService.Data.Twitch.Vod.ChunkDownloadingError.RetriesCount, value, _settingsService.Data.Twitch.Vod.ChunkDownloadingError, (u, n) => u.RetriesCount = n);
}
public int TwitchVodChunkDownloadingErrorRetryDelay
{
get => _settingsService.Data.Twitch.Vod.ChunkDownloadingError.RetryDelay;
set => SetProperty(_settingsService.Data.Twitch.Vod.ChunkDownloadingError.RetryDelay, value, _settingsService.Data.Twitch.Vod.ChunkDownloadingError, (u, n) => u.RetryDelay = n);
}
#endregion
#region CONSTRUCTORS
public SettingsViewModel(ISettingsService settingsService)
{
_settingsService = settingsService;
base.PropertyChanged += PropertyChangedEventHandler;
}
#endregion
#region PRIVATE METHODS
private async void PropertyChangedEventHandler(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
await _settingsService.Save();
}
#endregion
}
}

View File

@@ -6,6 +6,11 @@
xmlns:local="using:VDownload.Core.Views.Settings"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ctuc="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:ctc="using:CommunityToolkit.WinUI.Controls"
xmlns:ct="using:CommunityToolkit.WinUI"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
mc:Ignorable="d"
Background="{ThemeResource ViewBackgroundColor}">
@@ -19,5 +24,73 @@
Grid.Row="0"
FontSize="28"
FontWeight="SemiBold"/>
<ScrollViewer Grid.Row="1">
<StackPanel Spacing="20">
<StackPanel Spacing="5">
<TextBlock x:Uid="/VDownload.Core.Strings/SettingsViewResources/SearchingHeader"
FontWeight="Bold"
FontSize="15"/>
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/SearchingPlaylistCount">
<ctc:SettingsCard.HeaderIcon>
<BitmapIcon ShowAsMonochrome="False"
UriSource="{ThemeResource ImageSettingsViewSearchingPlaylistCount}"/>
</ctc:SettingsCard.HeaderIcon>
<NumberBox Value="{Binding SearchingPlaylistCount, Mode=TwoWay}"
Minimum="0"
SmallChange="1"
LargeChange="10"
SpinButtonPlacementMode="Compact"/>
</ctc:SettingsCard>
</StackPanel>
<StackPanel Spacing="5">
<TextBlock x:Uid="/VDownload.Core.Strings/SettingsViewResources/TwitchHeader"
FontWeight="Bold"
FontSize="15"/>
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TwitchVodPassiveTrimming">
<ctc:SettingsCard.HeaderIcon>
<BitmapIcon ShowAsMonochrome="False"
UriSource="{StaticResource ImageSourcesTwitch}"/>
</ctc:SettingsCard.HeaderIcon>
<ToggleSwitch IsOn="{Binding TwitchVodPassiveTrimming, Mode=TwoWay}"/>
</ctc:SettingsCard>
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TwitchVodParallelDownloads">
<ctc:SettingsCard.HeaderIcon>
<BitmapIcon ShowAsMonochrome="False"
UriSource="{StaticResource ImageSourcesTwitch}"/>
</ctc:SettingsCard.HeaderIcon>
<NumberBox Value="{Binding TwitchVodParallelDownloads, Mode=TwoWay}"
Minimum="1"
SmallChange="1"
LargeChange="10"
SpinButtonPlacementMode="Compact"/>
</ctc:SettingsCard>
<ctc:SettingsExpander x:Uid="/VDownload.Core.Strings/SettingsViewResources/TwitchVodChunkDownloadingErrorRetry">
<ctc:SettingsExpander.HeaderIcon>
<BitmapIcon ShowAsMonochrome="False"
UriSource="{StaticResource ImageSourcesTwitch}"/>
</ctc:SettingsExpander.HeaderIcon>
<ToggleSwitch IsOn="{Binding TwitchVodChunkDownloadingErrorRetry, Mode=TwoWay}"/>
<ctc:SettingsExpander.Items>
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TwitchVodChunkDownloadingErrorRetryCount"
IsEnabled="{Binding TwitchVodChunkDownloadingErrorRetry}">
<NumberBox Value="{Binding TwitchVodChunkDownloadingErrorRetryCount, Mode=TwoWay}"
Minimum="1"
SmallChange="1"
LargeChange="10"
SpinButtonPlacementMode="Compact"/>
</ctc:SettingsCard>
<ctc:SettingsCard x:Uid="/VDownload.Core.Strings/SettingsViewResources/TwitchVodChunkDownloadingErrorRetryDelay"
IsEnabled="{Binding TwitchVodChunkDownloadingErrorRetry}">
<NumberBox Value="{Binding TwitchVodChunkDownloadingErrorRetryDelay, Mode=TwoWay}"
Minimum="0"
SmallChange="1"
LargeChange="10"
SpinButtonPlacementMode="Compact"/>
</ctc:SettingsCard>
</ctc:SettingsExpander.Items>
</ctc:SettingsExpander>
</StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
</Page>