Stop querying kotcrab API, just count until release. Add mahoutsukai counter

This commit is contained in:
Alibek Omarov 2023-12-05 14:39:24 +03:00
parent 8dd590c781
commit 7ab1992287

43
main.py
View File

@ -62,16 +62,26 @@ def dump_and_compare_data(new):
os.rename('last.json.new', 'last.json')
def days_until_release(product, release_date):
days_until = (release_date - date.today()).days
if days_until > 0:
return '%d days until %s release' % (days_until, product)
elif days_until_ccc == 0:
return '%s is going to be released TODAY! 🎉' % (product)
elif days_until_ccc > -14:
return '%s was released few days ago, did you played it yet?' % (product)
def compose_text(data):
# text = 'Today\'s CCC Editing Progress: \n'
text = 'CCC editing is finished! 🎉'
days_until_ccc = (date(2023, 12, 25) - date.today()).days
if days_until_ccc > 0:
text += '\n\n%d days until Fate/Extra CCC translation release' % days_until_ccc
elif days_until_ccc == 0:
text += '\n\nFate/Extra CCC is going to be released TODAY! 🎉'
elif days_until_ccc > -14:
text += '\n\nFate/Extra CCC was released few days ago, did you played it yet?'
# text = 'CCC editing is finished! 🎉'
text = ''
text += days_until_release('Fate/Extra CCC translation', date(2023, 12, 25))
text += '\n\n'
# text += 'Now counting until Steam release of WITCH ON THE HOLY NIGHT as well too. You can wishlist the game here: https://store.steampowered.com/app/2052410/WITCH_ON_THE_HOLY_NIGHT/\n'
text += days_until_release('WITCH ON THE HOLY NIGHT(Steam)', date(2023, 12, 13))
return text
# for k in data:
# d = data[k]
@ -86,21 +96,12 @@ def compose_text(data):
#
# text += '%s: %.2f%% (%d/%d) %s\n' % (k, percent, d['edited'], d['all'], mark)
days_until_fsr = (date(2023, 9, 29) - date.today()).days
if days_until_fsr > 0:
text += '\n\n%d days until Fate/Samurai Remnant release' % days_until_fsr
elif days_until_fsr == 0:
text += '\n\nFate/Samurai Remnant is going to be released TODAY! 🎉'
elif days_until_fsr > -14:
text += '\n\nFate/Samurai Remnant was released few days ago, did you played it yet?'
return text
def main():
stats, ref = get_stats()
stats = parse_stats(stats, ref)
dump_and_compare_data(stats)
# stats, ref = get_stats()
# stats = parse_stats(stats, ref)
# dump_and_compare_data(stats)
text = compose_text(stats)
text = compose_text(None)
print(text)
# bots are forced to be unlisted on my instance anyway