소스 검색

disable gtts

ming 3 년 전
부모
커밋
c8a0203386
1개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 5
      main.py

+ 4 - 5
main.py

@@ -241,9 +241,8 @@ def file_prepare(name, name_hash,text_content,image_urls):
     text_file.close()
     print("text file made")
     #make mp3
-    language = 'zh-tw'
-    output = gTTS(text=text_content, lang=language, slow=False)
-    output.save(dir_sound+name_hash+".mp3")
+    tts = zhtts.TTS() 
+    tts.text2wav(text_content,dir_sound+name_hash+".mp3")
     print("mp3 file made")
     #make title as image
     txt2image(name, dir_title+name_hash+".png")
@@ -311,8 +310,8 @@ def file_prepare_v2(name, name_hash,text_content,image_urls):
     language = 'zh-tw'
     txt_idx = 0
     for txt in text_content:
-        output = gTTS(text=txt, lang=language, slow=False)
-        output.save(dir_sound+name_hash+"/"+str(txt_idx)+".mp3")
+        tts = zhtts.TTS() 
+        tts.text2wav(txt,dir_sound+name_hash+"/"+str(txt_idx)+".mp3")
         txt_idx+=1
     print("mp3 file made")
     #make title as image