diff --git a/notification.py b/notification.py index d38c09a..0fbd5e0 100644 --- a/notification.py +++ b/notification.py @@ -5,17 +5,57 @@ import logging import requests import json -from bot import login_beta, user_id, token_bot +from bot import login_beta, user_id, token_bot, client_id +from telegram.ext import Updater, CommandHandler +#Love Is War / Une serie pour tester le programme. +thetvdb_id= '354198' + + +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'] + + ###Recuperation du titre + 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) print("Token du bot Telegram : ", token_bot) - token = login_beta() + print("Cle API de betaserie : ", client_id) print("Token betaseries : ", token) + print("------------------------------") + print("\n\t") print("Pour arreter le script : CTRL+Z") + + check_latest() # while 1 : - # print("Salut!") + # #print(démarrage boucle) + # print("Boucle") + + + print("Erreur ! Fin de la boucle")