diff --git a/chaineTV.py b/chaineTV.py index b82cf14..9fa76f6 100644 --- a/chaineTV.py +++ b/chaineTV.py @@ -2,8 +2,11 @@ from tkinter import * import json import sys import os +import unicodedata class Interface: + import webbrowser + def __init__(self): self.datafilepath=os.path.dirname(os.path.realpath(__file__))+"/chaine.json" @@ -48,6 +51,9 @@ class Interface: except KeyError: print("numero de chaine inconnue") self.label2["text"] += "numero de chaine inconnue"+"\r" + self.value.set("") + return + self.label2["text"] += geturlprogrammetv(self.data[self.value.get()]) self.value.set("") @@ -110,6 +116,13 @@ def parsechaine(file): with open(file, 'w', encoding='utf-8') as f: json.dump(liste_chaine, f, indent=4) +def geturlprogrammetv(strsearch): + strsearch=unicodedata.normalize('NFD', strsearch).encode('ascii', 'ignore') + strsearch=strsearch.decode("utf-8") + strsearch=strsearch.replace(" ","+") + return "https://www.programme-tv.net/rechercher?q="+strsearch + + def cli(num): datafilepath=os.path.dirname(os.path.realpath(__file__))+"/chaine.json" @@ -119,7 +132,8 @@ def cli(num): print(data[num]) except KeyError: print("numero de chaine inconnue") - + return + print (geturlprogrammetv(data[num])) if len(sys.argv) > 1: