diff --git a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/CommonResources.resw b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/CommonResources.resw
index 9632010..6aa130d 100644
--- a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/CommonResources.resw
+++ b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/CommonResources.resw
@@ -159,4 +159,7 @@
Warning
+
+ Subscriptions
+
\ No newline at end of file
diff --git a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomeViewResources.resw b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomeViewResources.resw
index 907f620..5601658 100644
--- a/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomeViewResources.resw
+++ b/VDownload.Core/VDownload.Core.Strings/Strings/en-US/HomeViewResources.resw
@@ -132,6 +132,12 @@
Loading...
+
+ New videos:
+
+
+ No new videos
+
Playlist search
diff --git a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs
index d0f88c7..8dd6d3f 100644
--- a/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs
+++ b/VDownload.Core/VDownload.Core.ViewModels/Home/HomeViewModel.cs
@@ -10,6 +10,7 @@ using VDownload.Core.Tasks;
using VDownload.Models;
using VDownload.Services.Data.Configuration;
using VDownload.Services.Data.Settings;
+using VDownload.Services.Data.Subscriptions;
using VDownload.Services.UI.Dialogs;
using VDownload.Services.UI.StringResources;
using VDownload.Sources;
@@ -52,6 +53,7 @@ namespace VDownload.Core.ViewModels.Home
protected readonly ISettingsService _settingsService;
protected readonly IStringResourcesService _stringResourcesService;
protected readonly ISearchService _searchService;
+ protected readonly ISubscriptionsDataService _subscriptionsDataService;
protected readonly IDialogsService _dialogsService;
protected readonly IDownloadTaskManager _downloadTaskManager;
@@ -88,6 +90,9 @@ namespace VDownload.Core.ViewModels.Home
[ObservableProperty]
private OptionBarMessageIconType _optionBarMessageIcon;
+ [ObservableProperty]
+ private bool _optionBarLoadSubscriptionButtonChecked;
+
[ObservableProperty]
private bool _optionBarVideoSearchButtonChecked;
@@ -112,12 +117,13 @@ namespace VDownload.Core.ViewModels.Home
#region CONSTRUCTORS
- public HomeViewModel(IConfigurationService configurationService, ISettingsService settingsService, IStringResourcesService stringResourcesService, ISearchService searchService, IDialogsService dialogsService, IDownloadTaskManager downloadTaskManager, HomeVideoViewModel videoViewModel, HomeVideoCollectionViewModel videoCollectionViewModel)
+ public HomeViewModel(IConfigurationService configurationService, ISettingsService settingsService, IStringResourcesService stringResourcesService, ISearchService searchService, ISubscriptionsDataService subscriptionsDataService, IDialogsService dialogsService, IDownloadTaskManager downloadTaskManager, HomeVideoViewModel videoViewModel, HomeVideoCollectionViewModel videoCollectionViewModel)
{
_configurationService = configurationService;
_settingsService = settingsService;
_stringResourcesService = stringResourcesService;
_searchService = searchService;
+ _subscriptionsDataService = subscriptionsDataService;
_dialogsService = dialogsService;
_downloadTaskManager = downloadTaskManager;
@@ -145,6 +151,7 @@ namespace VDownload.Core.ViewModels.Home
OptionBarContent = OptionBarContentType.None;
OptionBarMessageIcon = OptionBarMessageIconType.None;
OptionBarMessage = null;
+ OptionBarLoadSubscriptionButtonChecked = false;
OptionBarVideoSearchButtonChecked = false;
OptionBarPlaylistSearchButtonChecked = false;
OptionBarSearchNotPending = true;
@@ -154,16 +161,64 @@ namespace VDownload.Core.ViewModels.Home
}
[RelayCommand]
- public void LoadFromSubscription()
+ public async Task LoadFromSubscription()
{
MainContent = _downloadsView;
+ OptionBarMessageIcon = OptionBarMessageIconType.None;
+ OptionBarMessage = null;
- OptionBarContent = OptionBarContentType.None;
- OptionBarVideoSearchButtonChecked = false;
- OptionBarPlaylistSearchButtonChecked = false;
- OptionBarSearchNotPending = false;
+ if (OptionBarLoadSubscriptionButtonChecked)
+ {
+ OptionBarContent = OptionBarContentType.None;
+ OptionBarVideoSearchButtonChecked = false;
+ OptionBarPlaylistSearchButtonChecked = false;
- //TODO: Load videos
+ OptionBarSearchNotPending = false;
+ OptionBarMessageIcon = OptionBarMessageIconType.ProgressRing;
+ OptionBarMessage = _stringResourcesService.HomeViewResources.Get("OptionBarMessageLoading");
+
+ SubscriptionsVideoList subList = new SubscriptionsVideoList { Name = _stringResourcesService.CommonResources.Get("SubscriptionVideoListName") };
+ List tasks = new List();
+ foreach (Subscription sub in _subscriptionsDataService.Data.ToArray())
+ {
+ tasks.Add(Task.Run(async () =>
+ {
+ Playlist playlist;
+ try
+ {
+ playlist = await _searchService.SearchPlaylist(sub.Url.OriginalString, 0);
+ }
+ catch (MediaSearchException)
+ {
+ return;
+ }
+
+ IEnumerable