diff --git a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomePlaylistViewResources.resw b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomePlaylistViewResources.resw new file mode 100644 index 0000000..c6dd639 --- /dev/null +++ b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomePlaylistViewResources.resw @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Directory + + + Browse + + + Filename + + + File options + + + If original video is not in selected type, it will be converted + + + File type + + + Filter + + + Media options + + + Only audio + + + Only video + + + Original + + + Media type + + + Quality + + + End at + + + Trim + + + Start at + + \ No newline at end of file diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/Helpers/VideoViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/Helpers/VideoViewModel.cs new file mode 100644 index 0000000..380a4ae --- /dev/null +++ b/VDownload.Core/VDownload.Core.ViewModels/Home/Helpers/VideoViewModel.cs @@ -0,0 +1,121 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VDownload.Models; +using VDownload.Services.Data.Settings; +using VDownload.Services.UI.StoragePicker; + +namespace VDownload.Core.ViewModels.Home.Helpers +{ + public partial class VideoViewModel : ObservableObject + { + #region SERVICES + + protected readonly ISettingsService _settingsService; + protected readonly IStoragePickerService _storagePickerService; + + #endregion + + + + #region PROPERTIES + + [ObservableProperty] + protected Uri _thumbnailUrl; + + [ObservableProperty] + protected string _title; + + [ObservableProperty] + protected string _author; + + [ObservableProperty] + protected DateTime _publishDate; + + [ObservableProperty] + protected TimeSpan _duration; + + [ObservableProperty] + protected long _views; + + + [ObservableProperty] + protected ObservableCollection _streams; + + [ObservableProperty] + protected VideoStream _selectedStream; + + [ObservableProperty] + protected MediaType _mediaType; + + [ObservableProperty] + protected TimeSpan _trimStart; + + [ObservableProperty] + protected TimeSpan _trimEnd; + + [ObservableProperty] + protected string _directoryPath; + + [ObservableProperty] + protected string _filename; + + [ObservableProperty] + protected VideoExtension _videoExtension; + + [ObservableProperty] + protected AudioExtension _audioExtension; + + #endregion + + + + #region CONSTRUCTORS + + public VideoViewModel(Video video, ISettingsService settingsService, IStoragePickerService storagePickerService) + { + _settingsService = settingsService; + _storagePickerService = storagePickerService; + + ThumbnailUrl = video.ThumbnailUrl; + Title = video.Title; + Author = video.Author; + PublishDate = video.PublishDate; + Duration = video.Duration; + Views = video.Views; + + Streams = [.. video.Streams]; + SelectedStream = Streams[0]; + MediaType = _settingsService.Data.Common.Tasks.DefaultMediaType; + TrimStart = TimeSpan.Zero; + TrimEnd = Duration; + DirectoryPath = _settingsService.Data.Common.Tasks.DefaultOutputDirectory; + Filename = Title.Length > 50 ? Title.Substring(0, 50) : Title; + VideoExtension = _settingsService.Data.Common.Tasks.DefaultVideoExtension; + AudioExtension = _settingsService.Data.Common.Tasks.DefaultAudioExtension; + } + + #endregion + + + + #region COMMANDS + + [RelayCommand] + public async Task Browse() + { + string? newDirectory = await _storagePickerService.OpenDirectory(); + if (newDirectory is not null) + { + this.DirectoryPath = newDirectory; + } + } + + #endregion + } +} diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs index de45d65..c705040 100644 --- a/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs +++ b/VDownload.Core/VDownload.Core.ViewModels/Home/HomePlaylistViewModel.cs @@ -1,11 +1,16 @@ using CommunityToolkit.Mvvm.ComponentModel; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using VDownload.Core.Tasks; +using VDownload.Core.ViewModels.Home.Helpers; using VDownload.Models; +using VDownload.Services.Data.Settings; +using VDownload.Services.UI.StoragePicker; using VDownload.Sources.Twitch.Configuration.Models; namespace VDownload.Core.ViewModels.Home @@ -14,7 +19,10 @@ namespace VDownload.Core.ViewModels.Home { #region SERVICES + protected readonly IDownloadTaskManager _tasksManager; + protected readonly ISettingsService _settingsService; + protected readonly IStoragePickerService _storagePickerService; #endregion @@ -22,7 +30,7 @@ namespace VDownload.Core.ViewModels.Home #region FIELDS - + protected Playlist _playlist; #endregion @@ -33,14 +41,22 @@ namespace VDownload.Core.ViewModels.Home [ObservableProperty] protected string _name; + [ObservableProperty] + protected ObservableCollection _videos; + #endregion #region CONSTRUCTORS - public HomePlaylistViewModel() - { + public HomePlaylistViewModel(IDownloadTaskManager tasksManager, ISettingsService settingsService, IStoragePickerService storagePickerService) + { + _tasksManager = tasksManager; + _settingsService = settingsService; + _storagePickerService = storagePickerService; + + _videos = new ObservableCollection(); } #endregion @@ -51,7 +67,15 @@ namespace VDownload.Core.ViewModels.Home public async Task LoadPlaylist(Playlist playlist) { - Name = playlist.Name; + _playlist = playlist; + + Videos.Clear(); + + Name = _playlist.Name; + foreach (Video video in playlist) + { + Videos.Add(new VideoViewModel(video, _settingsService, _storagePickerService)); + } } #endregion diff --git a/VDownload.Core/VDownload.Core.Views/Home/HomeDownloadsView.xaml b/VDownload.Core/VDownload.Core.Views/Home/HomeDownloadsView.xaml index a0a5bc0..e7d0345 100644 --- a/VDownload.Core/VDownload.Core.Views/Home/HomeDownloadsView.xaml +++ b/VDownload.Core/VDownload.Core.Views/Home/HomeDownloadsView.xaml @@ -327,10 +327,10 @@ + Width="40" + Height="48" + Command="{Binding ElementName=Root, Path=DataContext.StartCancelTaskCommand}" + CommandParameter="{Binding}"> @@ -28,21 +35,136 @@ FontWeight="Bold" FontSize="20" TextWrapping="WrapWholeWords"/> - - - - + + + + - - + + - - - + + + + + + + + + + + + + + + + + + + + + + 17 + 13 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VDownload.Core/VDownload.Core.Views/Home/HomeVideoView.xaml b/VDownload.Core/VDownload.Core.Views/Home/HomeVideoView.xaml index b9259fa..5347ac7 100644 --- a/VDownload.Core/VDownload.Core.Views/Home/HomeVideoView.xaml +++ b/VDownload.Core/VDownload.Core.Views/Home/HomeVideoView.xaml @@ -98,13 +98,7 @@ UriSource="{ThemeResource ImageHomeVideoViewQuality}"/> - - + SelectedItem="{Binding SelectedStream, Mode=TwoWay}"/> diff --git a/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs b/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs index 81d85d0..062e9ce 100644 --- a/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs +++ b/VDownload.Services/VDownload.Services.UI/VDownload.Services.UI.StringResources/StringResourcesService.cs @@ -8,6 +8,7 @@ namespace VDownload.Services.UI.StringResources StringResources BaseViewResources { get; } StringResources HomeViewResources { get; } StringResources HomeVideoViewResources { get; } + StringResources HomePlaylistViewResources { get; } StringResources HomeDownloadsViewResources { get; } StringResources AuthenticationViewResources { get; } StringResources NotificationsResources { get; } @@ -30,6 +31,7 @@ namespace VDownload.Services.UI.StringResources public StringResources BaseViewResources { get; protected set; } public StringResources HomeViewResources { get; protected set; } public StringResources HomeVideoViewResources { get; protected set; } + public StringResources HomePlaylistViewResources { get; protected set; } public StringResources HomeDownloadsViewResources { get; protected set; } public StringResources AuthenticationViewResources { get; protected set; } public StringResources NotificationsResources { get; protected set; } @@ -47,6 +49,7 @@ namespace VDownload.Services.UI.StringResources BaseViewResources = BuildResource("BaseViewResources"); HomeViewResources = BuildResource("HomeViewResources"); HomeVideoViewResources = BuildResource("HomeVideoViewResources"); + HomePlaylistViewResources = BuildResource("HomePlaylistViewResources"); HomeDownloadsViewResources = BuildResource("HomeDownloadsViewResources"); AuthenticationViewResources = BuildResource("AuthenticationViewResources"); NotificationsResources = BuildResource("NotificationsResources"); diff --git a/VDownload/App.xaml b/VDownload/App.xaml index 082c390..8c7e062 100644 --- a/VDownload/App.xaml +++ b/VDownload/App.xaml @@ -14,6 +14,7 @@ + diff --git a/VDownload/Assets/HomePlaylistView/AuthorDark.png b/VDownload/Assets/HomePlaylistView/AuthorDark.png new file mode 100644 index 0000000..bce1cfd Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/AuthorDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/AuthorLight.png b/VDownload/Assets/HomePlaylistView/AuthorLight.png new file mode 100644 index 0000000..48a0d5e Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/AuthorLight.png differ diff --git a/VDownload/Assets/HomePlaylistView/DateDark.png b/VDownload/Assets/HomePlaylistView/DateDark.png new file mode 100644 index 0000000..dab9efb Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/DateDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/DateLight.png b/VDownload/Assets/HomePlaylistView/DateLight.png new file mode 100644 index 0000000..a36dc6c Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/DateLight.png differ diff --git a/VDownload/Assets/HomePlaylistView/DirectoryDark.png b/VDownload/Assets/HomePlaylistView/DirectoryDark.png new file mode 100644 index 0000000..731e15e Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/DirectoryDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/DirectoryLight.png b/VDownload/Assets/HomePlaylistView/DirectoryLight.png new file mode 100644 index 0000000..b82f380 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/DirectoryLight.png differ diff --git a/VDownload/Assets/HomePlaylistView/ExtensionDark.png b/VDownload/Assets/HomePlaylistView/ExtensionDark.png new file mode 100644 index 0000000..0ef1391 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/ExtensionDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/ExtensionLight.png b/VDownload/Assets/HomePlaylistView/ExtensionLight.png new file mode 100644 index 0000000..27e0a2b Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/ExtensionLight.png differ diff --git a/VDownload/Assets/HomePlaylistView/FilenameDark.png b/VDownload/Assets/HomePlaylistView/FilenameDark.png new file mode 100644 index 0000000..4a9b713 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/FilenameDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/FilenameLight.png b/VDownload/Assets/HomePlaylistView/FilenameLight.png new file mode 100644 index 0000000..bd9da97 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/FilenameLight.png differ diff --git a/VDownload/Assets/HomePlaylistView/MediaDark.png b/VDownload/Assets/HomePlaylistView/MediaDark.png new file mode 100644 index 0000000..d7a3389 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/MediaDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/MediaLight.png b/VDownload/Assets/HomePlaylistView/MediaLight.png new file mode 100644 index 0000000..3d8410b Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/MediaLight.png differ diff --git a/VDownload/Assets/HomePlaylistView/QualityDark.png b/VDownload/Assets/HomePlaylistView/QualityDark.png new file mode 100644 index 0000000..71fe363 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/QualityDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/QualityLight.png b/VDownload/Assets/HomePlaylistView/QualityLight.png new file mode 100644 index 0000000..685ac0d Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/QualityLight.png differ diff --git a/VDownload/Assets/HomePlaylistView/TimeDark.png b/VDownload/Assets/HomePlaylistView/TimeDark.png new file mode 100644 index 0000000..a1b6bb7 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/TimeDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/TimeLight.png b/VDownload/Assets/HomePlaylistView/TimeLight.png new file mode 100644 index 0000000..be30883 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/TimeLight.png differ diff --git a/VDownload/Assets/HomePlaylistView/TrimDark.png b/VDownload/Assets/HomePlaylistView/TrimDark.png new file mode 100644 index 0000000..a696333 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/TrimDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/TrimLight.png b/VDownload/Assets/HomePlaylistView/TrimLight.png new file mode 100644 index 0000000..7d03273 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/TrimLight.png differ diff --git a/VDownload/Assets/HomePlaylistView/ViewDark.png b/VDownload/Assets/HomePlaylistView/ViewDark.png new file mode 100644 index 0000000..1f8b982 Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/ViewDark.png differ diff --git a/VDownload/Assets/HomePlaylistView/ViewLight.png b/VDownload/Assets/HomePlaylistView/ViewLight.png new file mode 100644 index 0000000..cd6ed5b Binary files /dev/null and b/VDownload/Assets/HomePlaylistView/ViewLight.png differ diff --git a/VDownload/Dictionaries/Images/ImagesHomePlaylistView.xaml b/VDownload/Dictionaries/Images/ImagesHomePlaylistView.xaml new file mode 100644 index 0000000..d31623e --- /dev/null +++ b/VDownload/Dictionaries/Images/ImagesHomePlaylistView.xaml @@ -0,0 +1,36 @@ + + + + + /Assets/HomePlaylistView/AuthorLight.png + /Assets/HomePlaylistView/DateLight.png + /Assets/HomePlaylistView/TimeLight.png + /Assets/HomePlaylistView/ViewLight.png + /Assets/HomePlaylistView/QualityLight.png + /Assets/HomePlaylistView/MediaLight.png + /Assets/HomePlaylistView/TrimLeftLight.png + /Assets/HomePlaylistView/TrimLight.png + /Assets/HomePlaylistView/TrimRightLight.png + /Assets/HomePlaylistView/DirectoryLight.png + /Assets/HomePlaylistView/FilenameLight.png + /Assets/HomePlaylistView/ExtensionLight.png + + + /Assets/HomePlaylistView/AuthorDark.png + /Assets/HomePlaylistView/DateDark.png + /Assets/HomePlaylistView/TimeDark.png + /Assets/HomePlaylistView/ViewDark.png + /Assets/HomePlaylistView/QualityDark.png + /Assets/HomePlaylistView/MediaDark.png + /Assets/HomePlaylistView/TrimLeftDark.png + /Assets/HomePlaylistView/TrimDark.png + /Assets/HomePlaylistView/TrimRightDark.png + /Assets/HomePlaylistView/DirectoryDark.png + /Assets/HomePlaylistView/FilenameDark.png + /Assets/HomePlaylistView/ExtensionDark.png + + + diff --git a/VDownload/VDownload.csproj b/VDownload/VDownload.csproj index d6a4c81..fcabdd4 100644 --- a/VDownload/VDownload.csproj +++ b/VDownload/VDownload.csproj @@ -44,6 +44,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -122,6 +142,7 @@ + @@ -251,6 +272,66 @@ Always + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + Always @@ -320,6 +401,9 @@ Always + + MSBuild:Compile + MSBuild:Compile