From ea7c557056383306c752be0a3a609095154b5e8e Mon Sep 17 00:00:00 2001 From: Cinabre Date: Sun, 3 May 2020 12:06:53 +0200 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'betaseries.py'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- betaseries.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/betaseries.py b/betaseries.py index 3c2861e..8bb24fc 100644 --- a/betaseries.py +++ b/betaseries.py @@ -166,18 +166,25 @@ def to_see(thetvdb_id): print(u"Vous etes à jour") return False -def seen(thetvdb_id): +def seen(thetvdb_id, mode): # Permet de mettre un episode en 'vu' sur betaseries print(u"Ajout d'un episode à la liste des vu") - file_path = 'latest/' + thetvdb_id + '.json' - - with open(file_path) as json_file: - data = json.load(json_file) - if data['seen'] == True : - send_message('Episode deja vu') - return API = create_api('seen', None) - API += str(data['id']) + + if mode == 'latest' : + file_path = 'latest/' + thetvdb_id + '.json' + + with open(file_path) as json_file: + data = json.load(json_file) + if data['seen'] == True : + send_message('Episode deja vu') + return + API += str(data['id']) + + if mode == 'watched' : + API += str(thetvdb_id) + + print(API) request = requests.post(API) if str(request) == '' : @@ -247,8 +254,7 @@ def what_2see(): def main(): - path = "series/102261.json" - print(get_ep_code_series(path)) + print("Nothing to do here") if __name__ == '__main__':