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"> <data name="Header.Text" xml:space="preserve">
<value>Settings</value> <value>Settings</value>
</data> </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> </root>

View File

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

View File

@@ -4,10 +4,82 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using VDownload.Services.Data.Settings;
namespace VDownload.Core.ViewModels.Settings namespace VDownload.Core.ViewModels.Settings
{ {
public class SettingsViewModel : ObservableObject 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:local="using:VDownload.Core.Views.Settings"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 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" mc:Ignorable="d"
Background="{ThemeResource ViewBackgroundColor}"> Background="{ThemeResource ViewBackgroundColor}">
@@ -19,5 +24,73 @@
Grid.Row="0" Grid.Row="0"
FontSize="28" FontSize="28"
FontWeight="SemiBold"/> 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> </Grid>
</Page> </Page>

View File

@@ -12,8 +12,8 @@ namespace VDownload.Services.Data.Settings
{ {
public class CommonSettings public class CommonSettings
{ {
[JsonProperty("max_number_of_videos_to_get_from_playlist")] [JsonProperty("searching")]
public int MaxNumberOfVideosToGetFromPlaylist { get; set; } = 0; public Searching Searching { get; set; } = new Searching();
[JsonProperty("temp")] [JsonProperty("temp")]
public Temp Temp { get; set; } = new Temp(); public Temp Temp { get; set; } = new Temp();

View File

@@ -0,0 +1,15 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VDownload.Services.Data.Settings.Models
{
public class Searching
{
[JsonProperty("max_number_of_videos_to_get_from_playlist")]
public int MaxNumberOfVideosToGetFromPlaylist { get; set; } = 0;
}
}

View File

@@ -18,6 +18,7 @@
<ResourceDictionary Source="Dictionaries/Images/ImagesHomeDownloadsView.xaml"/> <ResourceDictionary Source="Dictionaries/Images/ImagesHomeDownloadsView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesHomePlaylistView.xaml"/> <ResourceDictionary Source="Dictionaries/Images/ImagesHomePlaylistView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesHomeVideoView.xaml"/> <ResourceDictionary Source="Dictionaries/Images/ImagesHomeVideoView.xaml"/>
<ResourceDictionary Source="Dictionaries/Images/ImagesSettingsView.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<x:String x:Key="ImageSettingsViewSearchingPlaylistCount">/Assets/SettingsView/SearchingPlaylistCountLight.png</x:String>
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<x:String x:Key="ImageSettingsViewSearchingPlaylistCount">/Assets/SettingsView/SearchingPlaylistCountDark.png</x:String>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>

View File

@@ -148,6 +148,7 @@
<None Remove="Dictionaries\Images\ImagesHomeView.xaml" /> <None Remove="Dictionaries\Images\ImagesHomeView.xaml" />
<None Remove="Dictionaries\Images\ImagesLogo.xaml" /> <None Remove="Dictionaries\Images\ImagesLogo.xaml" />
<None Remove="Dictionaries\Images\ImagesOther.xaml" /> <None Remove="Dictionaries\Images\ImagesOther.xaml" />
<None Remove="Dictionaries\Images\ImagesSettingsView.xaml" />
<None Remove="Dictionaries\Images\ImagesSources.xaml" /> <None Remove="Dictionaries\Images\ImagesSources.xaml" />
</ItemGroup> </ItemGroup>
@@ -192,6 +193,12 @@
<Content Update="Assets\Other\Thumbnail.png"> <Content Update="Assets\Other\Thumbnail.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
<Content Update="Assets\SettingsView\SearchingPlaylistCountDark.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="Assets\SettingsView\SearchingPlaylistCountLight.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="Assets\BaseView\AuthenticationDark.png"> <None Update="Assets\BaseView\AuthenticationDark.png">
@@ -413,6 +420,9 @@
<None Update="configuration.json"> <None Update="configuration.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<Page Update="Dictionaries\Images\ImagesSettingsView.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="Dictionaries\Images\ImagesHomeView.xaml"> <Page Update="Dictionaries\Images\ImagesHomeView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>