Pārlūkot izejas kodu

Fonction pour créer le fichier + utilisation de telegram_api.py pour envoyer un message

master
TheBidouilleur pirms 8 mēnešiem
vecāks
revīzija
acd7845182
1 mainītis faili ar 10 papildinājumiem un 3 dzēšanām
  1. +10
    -3
      betaseries.py

+ 10
- 3
betaseries.py Parādīt failu

@@ -78,9 +78,8 @@ def check_latest(thetvdb_id):
# Si le fichier n'existe pas. Nous n'avons rien à comparer : Par définition nous sauvegardons les informations.

if path.exists(file_path) == False :
print("Fichier inexistant.. creation en cours...")
with open(file_path, "w") as write_file:
json.dump(episode_info, write_file)
print("Fichier inexistant ... Creation du fichier ")
create_file(file_path, episode_info)

@@ -107,6 +106,7 @@ def check_latest(thetvdb_id):
send_message(message)
#On supprime le fichier, et on le ré-écris avec les nouvelles informations.
os.remove(file_path)
create_file(file_path, episode_info)
return
if latest_season == saved_season:
@@ -115,9 +115,16 @@ def check_latest(thetvdb_id):
message = 'Nouvel episode de ' + title + ' ! ' + 'S' + str(latest_season) + 'E' + str(latest_episode)
send_message(message)
os.remove(file_path)
create_file(file_path, episode_info)
return
print("Aucun changement")
def create_file(file_path, episode_info):
with open(file_path, "w") as write_file:
json.dump(episode_info, write_file)


Notiek ielāde…
Atcelt
Saglabāt