Only fetching channel IDs from DB instead all of channel
This commit is contained in:
parent
a3a3c3a780
commit
d2b9a8b40c
@ -37,6 +37,7 @@ namespace YTManager.Tasks {
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gets some info about a youtube channel.
|
||||||
public static async Task<Models.Channel> Get_YTChannel(string channelID) {
|
public static async Task<Models.Channel> Get_YTChannel(string channelID) {
|
||||||
// YT API access key
|
// YT API access key
|
||||||
var youtubeService = new YouTubeService(new Google.Apis.Services.BaseClientService.Initializer()
|
var youtubeService = new YouTubeService(new Google.Apis.Services.BaseClientService.Initializer()
|
||||||
@ -68,10 +69,13 @@ namespace YTManager.Tasks {
|
|||||||
ops.UseNpgsql(dbstr);
|
ops.UseNpgsql(dbstr);
|
||||||
|
|
||||||
// Get all the channels from the db.
|
// 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.
|
// 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.
|
// Update videos for just one channel.
|
||||||
|
Loading…
Reference in New Issue
Block a user