diff --git a/notification.py b/notification.py index 074c3c9..87ca5ec 100644 --- a/notification.py +++ b/notification.py @@ -2,41 +2,21 @@ # -*- coding: utf-8 -*- # This program is dedicated to the public domain under the CC0 license. # Telegram - Betaseries + import logging import requests import json from bot import user_id, token_bot, client_id -from betaseries import login_beta, create_api +from betaseries import login_beta, create_api, check_latest from telegram.ext import Updater, CommandHandler - -#Love Is War / Une serie pour tester le programme. -thetvdb_id= '354198' +from config import series +import os.path +from os import path +import datetime -# def create_api(choice): - # if choice == 'latest' : - # base_url = 'https://api.betaseries.com/episodes/latest?' - # API = base_url + 'token=' + token + '&client_id=' + client_id + '&thetvdb_id=' + thetvdb_id - # return API - -def check_latest(): - API = create_api('latest') - request = requests.get(API) - if str(request) != '' : - return False - show = request.json() - episode = show['episode'] - - title = episode['show'] - print("Titre de la serie : ", str(title['title'])) - - # print("Episode : ", data[episode], " Saison : ", data[season] ) - - def main(): - global token - token = login_beta() print("------------------------------") print("Votre ID Telegram : ", user_id) @@ -47,12 +27,18 @@ def main(): print("\n\t") print("Pour arreter le script : CTRL+Z") - check_latest() + now = datetime.datetime.now() + print (now.strftime("%Y-%m-%d %H:%M:%S")) + for i in range(len(series)): + thetvdb_id = series[i] + check_latest(thetvdb_id) - print("Erreur ! Fin de la boucle") - - + + + + + #print("Erreur ! Fin de la boucle") if __name__ == '__main__':