改进
This commit is contained in:
@@ -2,7 +2,7 @@ import time
|
|||||||
import pathlib
|
import pathlib
|
||||||
import toml
|
import toml
|
||||||
import typing
|
import typing
|
||||||
import playsound
|
from playsound import playsound
|
||||||
import threading
|
import threading
|
||||||
import edge_tts as tts
|
import edge_tts as tts
|
||||||
|
|
||||||
@@ -47,9 +47,9 @@ def action_play_voice(content):
|
|||||||
"zh-CN-YunjianNeural",
|
"zh-CN-YunjianNeural",
|
||||||
)
|
)
|
||||||
communicate.save_sync(
|
communicate.save_sync(
|
||||||
f"./cache/voice/{content}"
|
f"./cache/voice/{content}.wav"
|
||||||
)
|
)
|
||||||
playsound()
|
playsound(f"./cache/voice/{content}.wav")
|
||||||
threading.Thread(target=play).start()
|
threading.Thread(target=play).start()
|
||||||
|
|
||||||
def get_daystamp() -> int:
|
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 textual.app import App
|
||||||
from screens import FileSelectorScreen
|
import screens
|
||||||
|
|
||||||
ver = "0.3.2"
|
|
||||||
|
|
||||||
class AppLauncher(App):
|
class AppLauncher(App):
|
||||||
CSS_PATH = "styles.css"
|
CSS_PATH = "styles.css"
|
||||||
TITLE = "潜进 - 辅助记忆程序"
|
TITLE = "潜进 - 辅助记忆程序"
|
||||||
BINDINGS = [("escape", "quit", "退出"), ("d", "toggle_dark", "改变色调")]
|
BINDINGS = [("escape", "quit", "退出"), ("d", "toggle_dark", "改变色调")]
|
||||||
SCREENS = {
|
SCREENS = {
|
||||||
"file_selection_screen": FileSelectorScreen,
|
"file_selection_screen": screens.FileSelectorScreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
def on_mount(self) -> None:
|
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_dir.mkdir(parents=True, exist_ok=True)
|
||||||
cache = cache_dir / f"{text}.wav"
|
cache = cache_dir / f"{text}.wav"
|
||||||
if not cache.exists():
|
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")
|
communicate.save_sync(f"./cache/voice/{text}.wav")
|
||||||
|
|
||||||
|
|
||||||
|
@@ -21,7 +21,7 @@ from reactor import Reactor, Apparatus
|
|||||||
import auxiliary as aux
|
import auxiliary as aux
|
||||||
import compositions as compo
|
import compositions as compo
|
||||||
import builtins
|
import builtins
|
||||||
import main
|
import metadata
|
||||||
|
|
||||||
config = aux.ConfigFile("config.toml")
|
config = aux.ConfigFile("config.toml")
|
||||||
|
|
||||||
@@ -108,7 +108,6 @@ class MemScreen(Screen):
|
|||||||
print(type(self.compo).__name__)
|
print(type(self.compo).__name__)
|
||||||
|
|
||||||
def action_play_voice(self):
|
def action_play_voice(self):
|
||||||
print("VOICE")
|
|
||||||
def play():
|
def play():
|
||||||
cache_dir = pathlib.Path(f"./cache/voice/")
|
cache_dir = pathlib.Path(f"./cache/voice/")
|
||||||
cache_dir.mkdir(parents=True, exist_ok=True)
|
cache_dir.mkdir(parents=True, exist_ok=True)
|
||||||
@@ -116,7 +115,7 @@ class MemScreen(Screen):
|
|||||||
if not cache.exists():
|
if not cache.exists():
|
||||||
communicate = tts.Communicate(
|
communicate = tts.Communicate(
|
||||||
self.reactor.current_atom[1].content.replace("/", ""),
|
self.reactor.current_atom[1].content.replace("/", ""),
|
||||||
"zh-CN-YunjianNeural",
|
"zh-CN-XiaoxiaoNeural",
|
||||||
)
|
)
|
||||||
communicate.save_sync(
|
communicate.save_sync(
|
||||||
f"./cache/voice/{self.reactor.current_atom[1].content.replace('/','')}.wav"
|
f"./cache/voice/{self.reactor.current_atom[1].content.replace('/','')}.wav"
|
||||||
@@ -191,7 +190,7 @@ class FileSelectorScreen(Screen):
|
|||||||
def compose(self) -> ComposeResult:
|
def compose(self) -> ComposeResult:
|
||||||
yield Header(show_clock=True)
|
yield Header(show_clock=True)
|
||||||
yield Container(
|
yield Container(
|
||||||
Label(f'欢迎使用 "潜进" 辅助记忆软件, 版本 {main.ver}', classes="title-label"),
|
Label(f'欢迎使用 "潜进" 辅助记忆软件, 版本 {metadata.ver}', classes="title-label"),
|
||||||
Label("选择要学习的文件:", classes="title-label"),
|
Label("选择要学习的文件:", classes="title-label"),
|
||||||
ListView(id="file-list", classes="file-list-view"),
|
ListView(id="file-list", classes="file-list-view"),
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user