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') 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): def compose_text(data):
# text = 'Today\'s CCC Editing Progress: \n' # text = 'Today\'s CCC Editing Progress: \n'
text = 'CCC editing is finished! 🎉' # text = 'CCC editing is finished! 🎉'
days_until_ccc = (date(2023, 12, 25) - date.today()).days text = ''
if days_until_ccc > 0:
text += '\n\n%d days until Fate/Extra CCC translation release' % days_until_ccc text += days_until_release('Fate/Extra CCC translation', date(2023, 12, 25))
elif days_until_ccc == 0: text += '\n\n'
text += '\n\nFate/Extra CCC is going to be released TODAY! 🎉' # 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'
elif days_until_ccc > -14: text += days_until_release('WITCH ON THE HOLY NIGHT(Steam)', date(2023, 12, 13))
text += '\n\nFate/Extra CCC was released few days ago, did you played it yet?'
return text
# for k in data: # for k in data:
# d = data[k] # 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) # 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(): def main():
stats, ref = get_stats() # stats, ref = get_stats()
stats = parse_stats(stats, ref) # stats = parse_stats(stats, ref)
dump_and_compare_data(stats) # dump_and_compare_data(stats)
text = compose_text(stats) text = compose_text(None)
print(text) print(text)
# bots are forced to be unlisted on my instance anyway # bots are forced to be unlisted on my instance anyway