Преглед на файлове

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

master
TheBidouilleur преди 8 месеца
родител
ревизия
acd7845182
променени са 1 файла, в които са добавени 10 реда и са изтрити 3 реда
  1. +10
    -3
      betaseries.py

+ 10
- 3
betaseries.py Целия файл

@@ -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)


Loading…
Отказ
Запис