diff --git a/run.py b/run.py index 82a2185..6853240 100644 --- a/run.py +++ b/run.py @@ -1,25 +1,31 @@ -from datetime import date -from config import date_dest, evenement -from get_date import get_date -from calcul import calcul -def main(): - - print("Twitter-DayCounter") - today = date.today() - dest = get_date(date_dest) - temps = calcul(today, dest) - - if temps == 0 : - print("IT'S TIME !") - else : - message = "Il reste " + str(temps) + " jours, avant " + evenement - print(message) - - - - -if __name__ == '__main__': - try : - main() - except KeyboardInterrupt : +from datetime import date +import time +from config import date_dest, evenement +from get_date import get_date +from twitter import tweet +from calcul import calcul +import sys + + +def main(): + while 1 : + print("Twitter-DayCounter") + today = date.today() + dest = get_date(date_dest) + temps = calcul(today, dest) + + if temps == 0 : + print("IT'S TIME !") + tweet(u"Fin du confinement ! Maintenant, je retourne dans ma chambre. ") + sys.exit(0) + else : + message = "Il reste " + temps + " jours, avant " + evenement + " !" + tweet(message) + time.sleep(86400) + + +if __name__ == '__main__': + try : + main() + except KeyboardInterrupt : print("Fermeture du programme...") \ No newline at end of file