From cf25521a26ba90ac81281c14b01c02dbd7e69d44 Mon Sep 17 00:00:00 2001 From: vincent Date: Fri, 17 Aug 2018 13:32:28 +0200 Subject: [PATCH] ajout d'un lien vers programme-tv.net --- chaineTV.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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: