@@ -4,6 +4,7 @@ using Google.Apis.YouTube.v3.Data;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Windows.ApplicationModel.Background;
|
||||
@@ -57,6 +58,9 @@ namespace FoxTube.Background
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> subscriptions = JsonConvert.DeserializeObject<Dictionary<string, string>>(await FileIO.ReadTextAsync(await ApplicationData.Current.RoamingFolder.GetFileAsync("background.json")));
|
||||
|
||||
List<SearchResult> results = new List<SearchResult>();
|
||||
|
||||
foreach (var s in subscriptions)
|
||||
{
|
||||
SearchResource.ListRequest request = Service.Search.List("snippet");
|
||||
@@ -67,9 +71,21 @@ namespace FoxTube.Background
|
||||
SearchListResponse response = await request.ExecuteAsync();
|
||||
|
||||
foreach (SearchResult i in response.Items)
|
||||
{
|
||||
results.Add(i);
|
||||
|
||||
ToastNotificationManager.CreateToastNotifier().Show(
|
||||
Notification.GetVideoToast(i.Id.VideoId, i.Snippet.ChannelId, i.Snippet.Title, i.Snippet.ChannelTitle, i.Snippet.Thumbnails.Medium.Url, s.Value));
|
||||
}
|
||||
}
|
||||
|
||||
results.OrderBy(i => i.Snippet.PublishedAt);
|
||||
|
||||
TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication();
|
||||
updater.EnableNotificationQueue(true);
|
||||
updater.Clear();
|
||||
for (int i = 0; i < 5; i++)
|
||||
updater.Update(Tiles.GetTileLayout(results[i].Snippet.Title, results[i].Snippet.ChannelTitle, results[i].Snippet.Thumbnails.Medium.Url, subscriptions[results[i].Snippet.ChannelId]));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user