diff --git a/auxiliary.py b/auxiliary.py index 6fcd90a..df0aa98 100644 --- a/auxiliary.py +++ b/auxiliary.py @@ -2,7 +2,7 @@ import time import pathlib import toml import typing -import playsound +from playsound import playsound import threading import edge_tts as tts @@ -47,9 +47,9 @@ def action_play_voice(content): "zh-CN-YunjianNeural", ) communicate.save_sync( - f"./cache/voice/{content}" + f"./cache/voice/{content}.wav" ) - playsound() + playsound(f"./cache/voice/{content}.wav") threading.Thread(target=play).start() def get_daystamp() -> int: diff --git a/electron/赤壁赋.toml b/electron/赤壁赋.toml new file mode 100644 index 0000000..e69de29 diff --git a/llmplugin.py b/llmplugin.py new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main.py index dbe0e7c..a9200f5 100644 --- a/main.py +++ b/main.py @@ -1,14 +1,12 @@ from textual.app import App -from screens import FileSelectorScreen - -ver = "0.3.2" +import screens class AppLauncher(App): CSS_PATH = "styles.css" TITLE = "潜进 - 辅助记忆程序" BINDINGS = [("escape", "quit", "退出"), ("d", "toggle_dark", "改变色调")] SCREENS = { - "file_selection_screen": FileSelectorScreen, + "file_selection_screen": screens.FileSelectorScreen, } def on_mount(self) -> None: diff --git a/metadata.py b/metadata.py new file mode 100644 index 0000000..6e8ddbb --- /dev/null +++ b/metadata.py @@ -0,0 +1 @@ +ver = "0.3.2" \ No newline at end of file diff --git a/nucleon/作文素材.dyna.toml b/nucleon/作文素材.dyna.toml new file mode 100644 index 0000000..e69de29 diff --git a/nucleon_hide/劝学.toml b/nucleon/劝学.toml similarity index 100% rename from nucleon_hide/劝学.toml rename to nucleon/劝学.toml diff --git a/nucleon_hide/师说.toml b/nucleon/师说.toml similarity index 100% rename from nucleon_hide/师说.toml rename to nucleon/师说.toml diff --git a/nucleon_hide/归去来兮辞.toml b/nucleon/归去来兮辞.toml similarity index 100% rename from nucleon_hide/归去来兮辞.toml rename to nucleon/归去来兮辞.toml diff --git a/nucleon_hide/梦游天姥吟留别.toml b/nucleon/梦游天姥吟留别.toml similarity index 100% rename from nucleon_hide/梦游天姥吟留别.toml rename to nucleon/梦游天姥吟留别.toml diff --git a/nucleon_hide/赤壁赋.toml b/nucleon/赤壁赋.toml similarity index 100% rename from nucleon_hide/赤壁赋.toml rename to nucleon/赤壁赋.toml diff --git a/nucleon_hide/陈情表.toml b/nucleon/陈情表.toml similarity index 100% rename from nucleon_hide/陈情表.toml rename to nucleon/陈情表.toml diff --git a/precache.py b/precache.py index cca1b7e..4a04c82 100644 --- a/precache.py +++ b/precache.py @@ -11,7 +11,7 @@ def precache(text: str): cache_dir.mkdir(parents=True, exist_ok=True) cache = cache_dir / f"{text}.wav" if not cache.exists(): - communicate = tts.Communicate(text, "zh-CN-YunjianNeural") + communicate = tts.Communicate(text, "zh-CN-XiaoxiaoNeural") communicate.save_sync(f"./cache/voice/{text}.wav") diff --git a/screens.py b/screens.py index d76697e..528f017 100644 --- a/screens.py +++ b/screens.py @@ -21,7 +21,7 @@ from reactor import Reactor, Apparatus import auxiliary as aux import compositions as compo import builtins -import main +import metadata config = aux.ConfigFile("config.toml") @@ -108,7 +108,6 @@ class MemScreen(Screen): print(type(self.compo).__name__) def action_play_voice(self): - print("VOICE") def play(): cache_dir = pathlib.Path(f"./cache/voice/") cache_dir.mkdir(parents=True, exist_ok=True) @@ -116,7 +115,7 @@ class MemScreen(Screen): if not cache.exists(): communicate = tts.Communicate( self.reactor.current_atom[1].content.replace("/", ""), - "zh-CN-YunjianNeural", + "zh-CN-XiaoxiaoNeural", ) communicate.save_sync( f"./cache/voice/{self.reactor.current_atom[1].content.replace('/','')}.wav" @@ -191,7 +190,7 @@ class FileSelectorScreen(Screen): def compose(self) -> ComposeResult: yield Header(show_clock=True) yield Container( - Label(f'欢迎使用 "潜进" 辅助记忆软件, 版本 {main.ver}', classes="title-label"), + Label(f'欢迎使用 "潜进" 辅助记忆软件, 版本 {metadata.ver}', classes="title-label"), Label("选择要学习的文件:", classes="title-label"), ListView(id="file-list", classes="file-list-view"), )