This commit is contained in:
恍兮惚兮 2024-05-15 02:00:20 +08:00
parent a001ba38c7
commit eda4c303ba
3 changed files with 11 additions and 3 deletions

View File

@ -119,6 +119,7 @@ class AnkiWindow(QDialog):
} }
) )
media = [] media = []
tempfiles=[]
for k, _ in [("audio", self.audiofile), ("image", self.cropedimagepath)]: for k, _ in [("audio", self.audiofile), ("image", self.cropedimagepath)]:
if _: if _:
media.append( media.append(
@ -130,6 +131,7 @@ class AnkiWindow(QDialog):
} }
] ]
) )
tempfiles.append(_)
else: else:
media.append([]) media.append([])
@ -145,7 +147,11 @@ class AnkiWindow(QDialog):
media[0], media[0],
media[1], media[1],
) )
for _ in tempfiles:
try:
os.remove(_)
except:
pass
class searchwordW(closeashidewindow): class searchwordW(closeashidewindow):
getnewsentencesignal = pyqtSignal(str, bool) getnewsentencesignal = pyqtSignal(str, bool)

View File

@ -15,6 +15,7 @@ model_htmlfront = """
{{explain}} {{explain}}
<br> <br>
{{image}} {{image}}
<div class='icon_audio'>{{audio}}</div>
""" """
model_htmlback = """ model_htmlback = """
{{word}} {{word}}
@ -22,4 +23,5 @@ model_htmlback = """
{{explain}} {{explain}}
<br> <br>
{{image}} {{image}}
<div class='icon_audio'>{{audio}}</div>
""" """

View File

@ -1,5 +1,5 @@
from myutils.config import globalconfig from myutils.config import globalconfig
import threading import threading, os
class TTSbase: class TTSbase:
@ -71,4 +71,4 @@ class TTSbase:
voice = globalconfig["reader"][self.typename]["voice"] voice = globalconfig["reader"][self.typename]["voice"]
voice_index = self.voicelist.index(voice) voice_index = self.voicelist.index(voice)
fname = self.speak(content, rate, voice, voice_index) fname = self.speak(content, rate, voice, voice_index)
return fname return os.path.abspath(fname)