| @@ -26,39 +26,40 @@ def series(): | |||||
| print("Le fichier watched_series.json a bien ete cree") | print("Le fichier watched_series.json a bien ete cree") | ||||
| def config(): | def config(): | ||||
| print("Configuration du fichier user_config.json") | |||||
| print(sys.argv()) | |||||
| print("Configuration du fichier user_config.json") | |||||
| print(sys.argv()) | |||||
| if len(sys.argv) != 7 : | |||||
| print("Il n'y a pas le bon nombre d'argument") | |||||
| sys.exit() | |||||
| if len(sys.argv) != 7 : | |||||
| print("Il n'y a pas le bon nombre d'argument") | |||||
| sys.exit() | |||||
| client_id = sys.argv[2] | |||||
| login = sys.argv[3] | |||||
| password = sys.argv[4] | |||||
| user_id = sys.argv[5] | |||||
| token_bot = sys.argv[6] | |||||
| client_id = sys.argv[2] | |||||
| login = sys.argv[3] | |||||
| password = sys.argv[4] | |||||
| user_id = sys.argv[5] | |||||
| token_bot = sys.argv[6] | |||||
| if path.exists('user_config.json') == False : | |||||
| print("Le fichier user_config.json n'existe pas") | |||||
| else : | |||||
| print("Le fichier user_config existe.. On le supprime") | |||||
| os.remove('user_config.json') | |||||
| if path.exists('user_config.json') == False : | |||||
| print("Le fichier user_config.json n'existe pas") | |||||
| else : | |||||
| print("Le fichier user_config existe.. On le supprime") | |||||
| os.remove('user_config.json') | |||||
| config = {"client_id" : client_id, | |||||
| config = {"client_id" : client_id, | |||||
| "login" : login, | "login" : login, | ||||
| "password" : password, | "password" : password, | ||||
| "user_id" : user_id, | "user_id" : user_id, | ||||
| "token_bot" : token_bot} | "token_bot" : token_bot} | ||||
| print("Dictionnaire de la configuration", config) | |||||
| print("Dictionnaire de la configuration", config) | |||||
| with open('user_config.json', 'w') as json_file: | |||||
| config = json.dump(config, json_file) | |||||
| with open('user_config.json', 'w') as json_file: | |||||
| config = json.dump(config, json_file) | |||||
| print("Le fichier user_config a bien ete cree") | |||||
| return | |||||
| print("Le fichier user_config a bien ete cree") | |||||
| return | |||||
| if len(sys.argv) == 1 : | if len(sys.argv) == 1 : | ||||