| @@ -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. | # Si le fichier n'existe pas. Nous n'avons rien à comparer : Par définition nous sauvegardons les informations. | ||||
| if path.exists(file_path) == False : | 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) | send_message(message) | ||||
| #On supprime le fichier, et on le ré-écris avec les nouvelles informations. | #On supprime le fichier, et on le ré-écris avec les nouvelles informations. | ||||
| os.remove(file_path) | os.remove(file_path) | ||||
| create_file(file_path, episode_info) | |||||
| return | return | ||||
| if latest_season == saved_season: | 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) | message = 'Nouvel episode de ' + title + ' ! ' + 'S' + str(latest_season) + 'E' + str(latest_episode) | ||||
| send_message(message) | send_message(message) | ||||
| os.remove(file_path) | os.remove(file_path) | ||||
| create_file(file_path, episode_info) | |||||
| return | return | ||||
| print("Aucun changement") | print("Aucun changement") | ||||
| def create_file(file_path, episode_info): | |||||
| with open(file_path, "w") as write_file: | |||||
| json.dump(episode_info, write_file) | |||||