Added a check for selftext

if selftext file exists it gets deleted and recreated if it is present in the thread
pull/205/head
MeDBeD1 3 years ago committed by GitHub
parent 6f6b7ad3fc
commit 3115155d89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,6 +21,11 @@ def save_text_to_mp3(reddit_obj):
tts.save(f"assets/mp3/title.mp3")
length += MP3(f"assets/mp3/title.mp3").info.length
try:
Path(f"assets/mp3/posttext.mp3").unlink()
except OSError as e:
pass
if reddit_obj["thread_post"] != "":
tts = gTTS(text=reddit_obj["thread_post"], lang="en", slow=False)
tts.save(f"assets/mp3/posttext.mp3")

Loading…
Cancel
Save