diff --git a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SettingsViewResources.resw b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SettingsViewResources.resw index 7773170..8b0e6f4 100644 --- a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SettingsViewResources.resw +++ b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/SettingsViewResources.resw @@ -120,4 +120,37 @@ Settings + + Searching + + + 0 = Get all + + + Default number of videos fetched from playlist + + + Twitch + + + Retry when downloading single VOD chunk fails + + + Number of retries + + + Time between fail and retry (in miliseconds) + + + WARNING: Too many chunks downloaded at once may cause performance problems + + + Maximum number of VOD chunks downloaded in parallel + + + Only chunks from trim start to trim end range will be downloaded + + + VOD passive trimming + \ No newline at end of file diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs index a9b9d75..9d17d50 100644 --- a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs +++ b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs @@ -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; } diff --git a/VDownload.Core/VDownload.Core.ViewModels/Settings/SettingsViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Settings/SettingsViewModel.cs index ab950b6..8315d0f 100644 --- a/VDownload.Core/VDownload.Core.ViewModels/Settings/SettingsViewModel.cs +++ b/VDownload.Core/VDownload.Core.ViewModels/Settings/SettingsViewModel.cs @@ -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 } } diff --git a/VDownload.Core/VDownload.Core.Views/Settings/SettingsView.xaml b/VDownload.Core/VDownload.Core.Views/Settings/SettingsView.xaml index 71c1613..f1fe579 100644 --- a/VDownload.Core/VDownload.Core.Views/Settings/SettingsView.xaml +++ b/VDownload.Core/VDownload.Core.Views/Settings/SettingsView.xaml @@ -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"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VDownload.Services/VDownload.Services.Data/VDownload.Services.Data.Settings/CommonSettings.cs b/VDownload.Services/VDownload.Services.Data/VDownload.Services.Data.Settings/CommonSettings.cs index 8211f13..fd0fbc7 100644 --- a/VDownload.Services/VDownload.Services.Data/VDownload.Services.Data.Settings/CommonSettings.cs +++ b/VDownload.Services/VDownload.Services.Data/VDownload.Services.Data.Settings/CommonSettings.cs @@ -12,8 +12,8 @@ namespace VDownload.Services.Data.Settings { public class CommonSettings { - [JsonProperty("max_number_of_videos_to_get_from_playlist")] - public int MaxNumberOfVideosToGetFromPlaylist { get; set; } = 0; + [JsonProperty("searching")] + public Searching Searching { get; set; } = new Searching(); [JsonProperty("temp")] public Temp Temp { get; set; } = new Temp(); diff --git a/VDownload.Services/VDownload.Services.Data/VDownload.Services.Data.Settings/Models/Searching.cs b/VDownload.Services/VDownload.Services.Data/VDownload.Services.Data.Settings/Models/Searching.cs new file mode 100644 index 0000000..cba8144 --- /dev/null +++ b/VDownload.Services/VDownload.Services.Data/VDownload.Services.Data.Settings/Models/Searching.cs @@ -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; + } +} diff --git a/VDownload/App.xaml b/VDownload/App.xaml index d88ed54..4814124 100644 --- a/VDownload/App.xaml +++ b/VDownload/App.xaml @@ -18,6 +18,7 @@ + diff --git a/VDownload/Assets/SettingsView/SearchingPlaylistCountDark.png b/VDownload/Assets/SettingsView/SearchingPlaylistCountDark.png new file mode 100644 index 0000000..01f741d Binary files /dev/null and b/VDownload/Assets/SettingsView/SearchingPlaylistCountDark.png differ diff --git a/VDownload/Assets/SettingsView/SearchingPlaylistCountLight.png b/VDownload/Assets/SettingsView/SearchingPlaylistCountLight.png new file mode 100644 index 0000000..4fb782f Binary files /dev/null and b/VDownload/Assets/SettingsView/SearchingPlaylistCountLight.png differ diff --git a/VDownload/Dictionaries/Images/ImagesSettingsView.xaml b/VDownload/Dictionaries/Images/ImagesSettingsView.xaml new file mode 100644 index 0000000..51545e0 --- /dev/null +++ b/VDownload/Dictionaries/Images/ImagesSettingsView.xaml @@ -0,0 +1,13 @@ + + + + + /Assets/SettingsView/SearchingPlaylistCountLight.png + + + /Assets/SettingsView/SearchingPlaylistCountDark.png + + + diff --git a/VDownload/VDownload.csproj b/VDownload/VDownload.csproj index 8a756cf..ac08e63 100644 --- a/VDownload/VDownload.csproj +++ b/VDownload/VDownload.csproj @@ -148,6 +148,7 @@ + @@ -192,6 +193,12 @@ Always + + Always + + + Always + @@ -413,6 +420,9 @@ Always + + MSBuild:Compile + MSBuild:Compile