From be9d434ee0693fb09596ccf92abfb0881309077b Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 10 Apr 2018 20:46:25 +0200 Subject: [PATCH] amelioration mode cli --- chaineTV.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/chaineTV.py b/chaineTV.py index 0f9882f..651abbe 100644 --- a/chaineTV.py +++ b/chaineTV.py @@ -110,9 +110,14 @@ def parsechaine(file): json.dump(liste_chaine, f, indent=4) - - - +def cli(num): + datafilepath=os.path.dirname(os.path.realpath(__file__))+"/chaine.json" + data = load_jsonfile(datafilepath) + print(num) + try: + print(data[num]) + except KeyError: + print("numero de chaine inconnue") interface = Interface() @@ -124,8 +129,9 @@ else: if arg == True: for i in sys.argv[1:]: - interface.value.set(i) - interface.click() - interface.value.set("") + if i =="update": + parsechaine(os.path.dirname(os.path.realpath(__file__))+"/chaine.json") + else: + cli(i) else: interface.mainloop()