formatting: run precommit on all files

This commit is contained in:
lanvent
2023-04-22 12:01:29 +08:00
parent eaf4e9174f
commit 618c94edb8
40 changed files with 229 additions and 647 deletions

View File

@@ -24,11 +24,7 @@ class GoogleVoice(Voice):
audio = self.recognizer.record(source)
try:
text = self.recognizer.recognize_google(audio, language="zh-CN")
logger.info(
"[Google] voiceToText text={} voice file name={}".format(
text, voice_file
)
)
logger.info("[Google] voiceToText text={} voice file name={}".format(text, voice_file))
reply = Reply(ReplyType.TEXT, text)
except speech_recognition.UnknownValueError:
reply = Reply(ReplyType.ERROR, "抱歉,我听不懂")
@@ -42,9 +38,7 @@ class GoogleVoice(Voice):
mp3File = TmpDir().path() + "reply-" + str(int(time.time())) + ".mp3"
tts = gTTS(text=text, lang="zh")
tts.save(mp3File)
logger.info(
"[Google] textToVoice text={} voice file name={}".format(text, mp3File)
)
logger.info("[Google] textToVoice text={} voice file name={}".format(text, mp3File))
reply = Reply(ReplyType.VOICE, mp3File)
except Exception as e:
reply = Reply(ReplyType.ERROR, str(e))