From d2b9a8b40cdcb7755b911d6cb9dfd15e9e94704e Mon Sep 17 00:00:00 2001 From: hak8or Date: Tue, 20 Feb 2018 00:13:06 -0500 Subject: [PATCH] Only fetching channel IDs from DB instead all of channel --- YTManager/Tasks/FetchVideos.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/YTManager/Tasks/FetchVideos.cs b/YTManager/Tasks/FetchVideos.cs index 5d4af8f..10679f1 100644 --- a/YTManager/Tasks/FetchVideos.cs +++ b/YTManager/Tasks/FetchVideos.cs @@ -37,6 +37,7 @@ namespace YTManager.Tasks { }).ToList(); } + // Gets some info about a youtube channel. public static async Task Get_YTChannel(string channelID) { // YT API access key var youtubeService = new YouTubeService(new Google.Apis.Services.BaseClientService.Initializer() @@ -68,10 +69,13 @@ namespace YTManager.Tasks { ops.UseNpgsql(dbstr); // Get all the channels from the db. - var channels = await (new MediaDB(ops.Options)).Channels.ToListAsync(); + var channel_ids = await + (new MediaDB(ops.Options)) + .Channels.Select(ch => ch.YoutubeID) + .ToListAsync(); // For each channel, do an update. - channels.ForEach(async ch => await ChannelUpdate(dbstr, ch.YoutubeID)); + channel_ids.ForEach(async id => await ChannelUpdate(dbstr, id)); } // Update videos for just one channel.