Minor tweaks to AiringList before trying to handle late-week airing

This commit is contained in:
2025-02-17 01:03:06 -05:00
parent acac2a25e8
commit 6a50c94cf2
2 changed files with 7 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ public class TMDBCache
public async Task SetCacheItem(String key, TMDBCacheItem item)
{
var db = redis.GetDatabase();
String jsonItem = JsonSerializer.Serialize(item);
await db.StringSetAsync(key, jsonItem, CacheExpiration);
}
@@ -38,13 +39,14 @@ public class TMDBCache
{
var db = redis.GetDatabase();
String jsonItem = JsonSerializer.Serialize(list);
await db.StringSetAsync("AiringSoon", jsonItem, CacheExpiration);
await db.StringSetAsync("AiringSoon", jsonItem, TimeSpan.FromDays(60));
}
public async Task<List<AiringSoonItem>> GetAiringList()
{
var db = redis.GetDatabase();
String jsonItem = await db.StringGetAsync("AiringSoon");
if(!String.IsNullOrEmpty(jsonItem))

View File

@@ -62,6 +62,7 @@ namespace AnimeAnnouncer
nyaaIndexer.NewPost += OnNewPost;
nyaaIndexer.RssReadFinished += OnRssReadFinished;
//nyaaIndexer.IterationSleepTime = 60;
nyaaIndexer.Start(true);
Console.WriteLine("Press enter to quit...");
@@ -222,7 +223,7 @@ namespace AnimeAnnouncer
_ = tmdbCache.SetCacheItem($"ShowCache-{title}", cachedShow);
Console.WriteLine($"{title} Added to cache");
if(latestSeason.AirDate < DateTime.Now && (latestSeason.AirDate + TimeSpan.FromDays(180)) > DateTime.Now &&
(showResult.NextEpisodeToAir.AirDate + TimeSpan.FromDays(30)) > DateTime.Now)
((showResult.Status == "Ended" ? showResult.LastAirDate : showResult.NextEpisodeToAir.AirDate) + TimeSpan.FromDays(30)) > DateTime.Now)
UpdateAiringShowList(cachedShow);
}
catch(Exception ex)
@@ -310,15 +311,13 @@ namespace AnimeAnnouncer
else if (!finaleConfirmed)
{
Console.WriteLine($"Would have announced finale for {title}, on S{cachedShow.LatestSeasonNumber}E{cachedShow.LastEpisodeNumber} but the finale episode type was not found.");
}
else
{
_ = tmdbCache.SetPair($"ShowAnnounced-{supposedShowId}", latestSeasonNumber.ToString());
return;
}
if(mastodonClient != null && cachedShow != null)
{
try
{
_ = tmdbCache.SetPair($"ShowAnnounced-{supposedShowId}", latestSeasonNumber.ToString());
PostStatus(cachedShow);
}
catch(Exception ex)