Added refreshed since for channels
This commit is contained in:
@ -58,7 +58,8 @@ namespace YTManager.Tasks {
|
||||
Title = response.Items.First().Snippet.Title,
|
||||
ThumbnailURL = response.Items.First().Snippet.Thumbnails.Medium.Url,
|
||||
YoutubeID = channelID,
|
||||
AddedtoDB = DateTime.Now
|
||||
AddedtoDB = DateTime.Now,
|
||||
Refreshed = DateTime.MinValue
|
||||
};
|
||||
}
|
||||
|
||||
@ -68,10 +69,12 @@ namespace YTManager.Tasks {
|
||||
var ops = new DbContextOptionsBuilder<MediaDB>();
|
||||
ops.UseNpgsql(dbstr);
|
||||
|
||||
// Get all the channels from the db.
|
||||
// Get all the channels from the db that expired.
|
||||
var threshold = DateTime.Now.Subtract(TimeSpan.FromSeconds(100));
|
||||
var channel_ids = await
|
||||
(new MediaDB(ops.Options))
|
||||
.Channels.Select(ch => ch.YoutubeID)
|
||||
(new MediaDB(ops.Options)).Channels
|
||||
.Where(ch => ch.Refreshed < threshold)
|
||||
.Select(ch => ch.YoutubeID)
|
||||
.ToListAsync();
|
||||
|
||||
// For each channel, do an update.
|
||||
|
Reference in New Issue
Block a user