改进
This commit is contained in:
@@ -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:
|
||||
|
0
electron/赤壁赋.toml
Normal file
0
electron/赤壁赋.toml
Normal file
0
llmplugin.py
Normal file
0
llmplugin.py
Normal file
6
main.py
6
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:
|
||||
|
1
metadata.py
Normal file
1
metadata.py
Normal file
@@ -0,0 +1 @@
|
||||
ver = "0.3.2"
|
0
nucleon/作文素材.dyna.toml
Normal file
0
nucleon/作文素材.dyna.toml
Normal file
@@ -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")
|
||||
|
||||
|
||||
|
@@ -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"),
|
||||
)
|
||||
|
Reference in New Issue
Block a user