Initial commit of Airing Soon list
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.ExceptionServices;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using AnimeAnnouncer.Cache;
|
using AnimeAnnouncer.Cache;
|
||||||
@@ -81,6 +82,14 @@ namespace AnimeAnnouncer
|
|||||||
|
|
||||||
static void OnRssReadFinished()
|
static void OnRssReadFinished()
|
||||||
{
|
{
|
||||||
|
if(DateTime.Today.Day == 1)
|
||||||
|
{
|
||||||
|
if(!tmdbCache.KeyExists($"UpcomingAnnounced-{DateTime.Today.Year}-{DateTime.Today.Month}").Result)
|
||||||
|
{
|
||||||
|
CreateAiringMonthPost().Wait();
|
||||||
|
tmdbCache.SetPair($"UpcomingAnnounced-{DateTime.Today.Year}-{DateTime.Today.Month}", "1").Wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,6 +326,46 @@ namespace AnimeAnnouncer
|
|||||||
Console.WriteLine($"Choosing {title} as a finished season!");
|
Console.WriteLine($"Choosing {title} as a finished season!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static async Task CreateAiringMonthPost()
|
||||||
|
{
|
||||||
|
var airingSoon = await tmdbCache.GetAiringList();
|
||||||
|
DateTime beginningOfMonth = DateTime.Today;
|
||||||
|
DateTime endOfMonth = DateTime.Today.AddMonths(1);
|
||||||
|
var airingThisMonth = airingSoon.Where(p => p.LastAirDate >= beginningOfMonth && p.LastAirDate <= endOfMonth).ToList();
|
||||||
|
String statusText = $"DUBBED anime airing this month (probably){Environment.NewLine + Environment.NewLine}";
|
||||||
|
int cnt = 1;
|
||||||
|
for(int i = 0;i < airingThisMonth.Count;i++, cnt++)
|
||||||
|
{
|
||||||
|
var airing = airingThisMonth[i];
|
||||||
|
if(!await tmdbCache.KeyExists($"ShowAnnounced-{airing.ShowID}"))
|
||||||
|
{ //TODO: fix for seasons
|
||||||
|
statusText += $"{cnt}. {airing.Title} on {airing.LastAirDate:MM/dd/yyyy}{Environment.NewLine}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int neededPostCount = (int)Math.Ceiling((decimal)statusText.Length / 500);
|
||||||
|
if(neededPostCount >= 2)
|
||||||
|
{
|
||||||
|
statusText = statusText[..497] + "...";
|
||||||
|
}
|
||||||
|
_ = mastodonClient.PublishStatus(statusText,
|
||||||
|
Visibility.Public, null);
|
||||||
|
/*
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(cnt = 1; cnt < neededPostCount; cnt++)
|
||||||
|
{
|
||||||
|
//go back and find a line break
|
||||||
|
String postPart = "";
|
||||||
|
//_ = mastodonClient.PublishStatus(${statusText},
|
||||||
|
// Visibility.Public, null);
|
||||||
|
System.Threading.Thread.Sleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
private static async void PostStatus(TMDBCacheItem cachedShow)
|
private static async void PostStatus(TMDBCacheItem cachedShow)
|
||||||
{
|
{
|
||||||
//get poster
|
//get poster
|
||||||
|
|||||||
Reference in New Issue
Block a user