mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-15 08:53:53 +08:00
except
This commit is contained in:
parent
e8d6776229
commit
7d74fca176
@ -6,8 +6,6 @@ from urllib.parse import quote
|
||||
|
||||
class TTS(TTSbase):
|
||||
def getvoicelist(self):
|
||||
if self.config["voices"] == "":
|
||||
return [(0, 0, 0)], []
|
||||
responseVits = requests.get(
|
||||
urljoin(self.config["URL"], self.config["voices"])
|
||||
).json()
|
||||
|
@ -9,9 +9,10 @@ from myutils.subproc import subproc_w, autoproc
|
||||
class TTS(TTSbase):
|
||||
def getvoicelist(self):
|
||||
voicelist = []
|
||||
if os.path.exists(self.config["path"]) == False:
|
||||
return []
|
||||
l = os.listdir(os.path.join(self.config["path"], "Voice"))
|
||||
_p = os.path.join(self.config["path"], "Voice")
|
||||
if os.path.exists(_p) == False:
|
||||
raise Exception(f"not exists {_p}")
|
||||
l = os.listdir(_p)
|
||||
|
||||
for _ in l:
|
||||
if "_" in _:
|
||||
|
@ -7,8 +7,6 @@ from tts.basettsclass import TTSbase
|
||||
class TTS(TTSbase):
|
||||
|
||||
def getvoicelist(self):
|
||||
while True:
|
||||
try:
|
||||
|
||||
headers = {
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
||||
@ -36,17 +34,13 @@ class TTS(TTSbase):
|
||||
vis = []
|
||||
idxs = []
|
||||
for speaker in response:
|
||||
name=speaker['name']
|
||||
name = speaker["name"]
|
||||
styles = speaker["styles"]
|
||||
for style in styles:
|
||||
idxs.append(style['id'])
|
||||
vis.append(name+ ' '+ style["name"])
|
||||
idxs.append(style["id"])
|
||||
vis.append(name + " " + style["name"])
|
||||
|
||||
return idxs, vis
|
||||
except:
|
||||
print_exc()
|
||||
time.sleep(1)
|
||||
break
|
||||
|
||||
def speak(self, content, rate, voice):
|
||||
headers = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user