diff --git a/src/controller/controller.py b/src/controller/controller.py index 87a6cc4..826f496 100644 --- a/src/controller/controller.py +++ b/src/controller/controller.py @@ -42,7 +42,7 @@ def left_listbox_onselect(self, evt): self.current_select = text self.current_dir = "../data/" + text + "/" - self.pause_len = float(self.app.options[POSITIONS][self.current_select][POSI].split("\n")[0]) + self.pause_len = float(self.app.option[POSITIONS][self.current_select][POSI].split("\n")[0]) self.app.pre_load() self.app.show_view() @@ -58,13 +58,13 @@ def annotation_click(self, event): index = self.app.annotation_text_area_other.index("current") txt = self.app.book_other self.app.root.update() - if self.app.options[POSITIONS][self.app.current_select][AUDIO] == EN: - self.app.options[POSITIONS][self.app.current_select][AUDIO] = RU + if self.app.option[POSITIONS][self.app.current_select][AUDIO] == EN: + self.app.option[POSITIONS][self.app.current_select][AUDIO] = RU self.app.russian_click() else: - self.app.options[POSITIONS][self.app.current_select][AUDIO] = EN + self.app.option[POSITIONS][self.app.current_select][AUDIO] = EN self.app.english_click() - if self.app.options[POSITIONS][self.app.current_select][AUDIO] == EN: + if self.app.option[POSITIONS][self.app.current_select][AUDIO] == EN: curr = R_POS curr_other = L_POS self.app.sync_other = self.app.rus_sync @@ -112,8 +112,8 @@ def scroll_other(self): self.app.annotation_text_area_other.tag_remove("start", "1.0", "end") self.app.annotation_text_area_other.tag_add("start", f"1.0", f"{count_lines}.{count_chars}") self.app.annotation_text_area_other.tag_config("start", - background=self.app.options[SEL], - foreground=self.app.options[FG]) + background=self.app.option[SEL], + foreground=self.app.option[FG]) self.centered_insert(center=True) def centered_insert(self, center=False): diff --git a/src/controller/createsync.py b/src/controller/createsync.py index 71e047b..7e65439 100644 --- a/src/controller/createsync.py +++ b/src/controller/createsync.py @@ -46,11 +46,13 @@ for d in del_me: if os.path.exists(d): os.remove(d) - recognizer_eng = recognizer.RecognizerClass(model_path=f"../eng", - output=f"{data}/{book}", language="eng") + recognizer_eng = recognizer.RecognizerClass(model_path=f"../../recognize/eng", + output=f"{data}/{book}", + language="eng", config=config) recognizer_eng.create_map() - recognizer_rus = recognizer.RecognizerClass(model_path=f"../rus", - output=f"{data}/{book}", language="rus") + recognizer_rus = recognizer.RecognizerClass(model_path=f"../../recognize/rus", + output=f"{data}/{book}", + language="rus", config=config) recognizer_rus.create_map() if not os.path.exists(f"{data}/{book}/{config.RUS_SYNC}"): diff --git a/src/controller/player.py b/src/controller/player.py index 95f13f2..11c1b76 100644 --- a/src/controller/player.py +++ b/src/controller/player.py @@ -69,7 +69,7 @@ def language_click(self, textarea, flac): self.app.pause() self.app.statusbar_label1.configure( text=STATUS_AUDIO[self.app.locale] + ": " + - self.app.options[POSITIONS][self.app.current_select][AUDIO]) + self.app.option[POSITIONS][self.app.current_select][AUDIO]) self.app.annotation_text_area1.tag_remove("start", "1.0", "end") self.app.annotation_text_area2.tag_remove("start", "1.0", "end") pygame.mixer.music.load(flac) @@ -81,7 +81,7 @@ def play_timer(self): return self.app.annotation_text_area1.tag_remove("start", "1.0", "end") self.app.annotation_text_area2.tag_remove("start", "1.0", "end") - if self.app.options[POSITIONS][self.app.current_select][AUDIO] == EN: + if self.app.option[POSITIONS][self.app.current_select][AUDIO] == EN: curr = R_POS curr_other = L_POS self.app.annotation_text_area = self.app.annotation_text_area1 @@ -116,8 +116,8 @@ def play_timer(self): self.app.annotation_text_area.mark_set("insert", f"{count_lines}.{count_chars}") self.app.annotation_text_area.tag_add("start", f"1.0", f"{count_lines}.{count_chars}") self.app.annotation_text_area.tag_config("start", - background=self.app.options[SEL], - foreground=self.app.options[FG]) + background=self.app.option[SEL], + foreground=self.app.option[FG]) if self.app.flag_pause: self.app.annotation_text_area.see("insert") self.app.centered_insert() @@ -137,7 +137,7 @@ def play_timer(self): text=STATUS_POSITION[self.app.locale] + ": " + self.app.annotation_text_area1.index("current") + "/" + self.app.annotation_text_area2.index("current")) - self.app.options[POSITIONS][self.app.current_select][POSI] = \ + self.app.option[POSITIONS][self.app.current_select][POSI] = \ str(self.app.pause_len + pygame.mixer.music.get_pos()) + \ "\n" + f"{count_lines}.{count_chars}" + \ "\n" + str(self.app.start) diff --git a/src/controller/realization.py b/src/controller/realization.py index 8c6c6ca..bbe3f0c 100644 --- a/src/controller/realization.py +++ b/src/controller/realization.py @@ -21,7 +21,7 @@ def menu_service_language(self, event=None): if self.app.locale == event: return self.app.set_locale(event) - self.app.options[LOCALE] = self.app.locale + self.app.option[LOCALE] = self.app.locale self.app.save_options() showinfo(MENU_SERVICE[self.app.locale], MENU_SERVICE_RESTART[self.app.locale]) os.execv(sys.executable, [sys.executable, __file__] + sys.argv) diff --git a/src/controller/recognizer.py b/src/controller/recognizer.py index cc9bb76..326e368 100644 --- a/src/controller/recognizer.py +++ b/src/controller/recognizer.py @@ -4,10 +4,14 @@ class RecognizerClass: - def __init__(self, model_path, output, language): + def __init__(self, model_path, output, language, config): self.language = language - self.MAPJSON = f"{output}/{language}.map.json" - self.WAV = f"{output}/{language}.wav" + if self.language == "rus": + self.MAPJSON = f"{output}/{config.RUS_MAP}" + self.WAV = f"{output}/{config.RUS_WAV}" + else: + self.MAPJSON = f"{output}/{config.ENG_MAP}" + self.WAV = f"{output}/{config.ENG_WAV}" self.MODEL_PATH = model_path def create_map(self):