From 1698df8426c19c7c9dfd0c26ea71c007f1265250 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Fri, 18 Jun 2021 13:02:56 +0200 Subject: [PATCH] if option.json is not found, it will be created --- source/option.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/option.py b/source/option.py index 9d97aac..7069c7b 100644 --- a/source/option.py +++ b/source/option.py @@ -1,4 +1,14 @@ import json +import os + +default_option = { + "language": "en", + "format": "WBFS", + "disable_download": False, + "del_track_after_conv": False, + "dont_check_for_update": False, + "process_track": 8 +} def change_option(self, option, value, restart=False): @@ -9,4 +19,6 @@ def change_option(self, option, value, restart=False): def load_option(self): + if not(os.path.exists("./option.json")): + with open("./option.json", "w", encoding="utf-8") as f: json.dump(default_option, f, ensure_ascii=False) with open("./option.json", encoding="utf-8") as f: self.option = json.load(f) \ No newline at end of file