fix for windows users
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = edge-tts
|
name = edge-tts
|
||||||
version = 4.0.8
|
version = 4.0.9
|
||||||
author = rany
|
author = rany
|
||||||
author_email = ranygh@riseup.net
|
author_email = ranygh@riseup.net
|
||||||
description = Microsoft Edge's TTS
|
description = Microsoft Edge's TTS
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
Playback TTS with subtitles using edge-tts and mpv.
|
Playback TTS with subtitles using edge-tts and mpv.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -15,8 +16,12 @@ def main():
|
|||||||
Main function.
|
Main function.
|
||||||
"""
|
"""
|
||||||
if which("mpv") and which("edge-tts"):
|
if which("mpv") and which("edge-tts"):
|
||||||
with tempfile.NamedTemporaryFile() as media:
|
media = tempfile.NamedTemporaryFile(delete=False)
|
||||||
with tempfile.NamedTemporaryFile() as subtitle:
|
subtitle = tempfile.NamedTemporaryFile(delete=False)
|
||||||
|
try:
|
||||||
|
media.close()
|
||||||
|
subtitle.close()
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print(f"Media file: {media.name}")
|
print(f"Media file: {media.name}")
|
||||||
print(f"Subtitle file: {subtitle.name}\n")
|
print(f"Subtitle file: {subtitle.name}\n")
|
||||||
@@ -40,6 +45,9 @@ def main():
|
|||||||
]
|
]
|
||||||
) as process:
|
) as process:
|
||||||
process.communicate()
|
process.communicate()
|
||||||
|
finally:
|
||||||
|
os.unlink(media.name)
|
||||||
|
os.unlink(subtitle.name)
|
||||||
else:
|
else:
|
||||||
print("This script requires mpv and edge-tts.")
|
print("This script requires mpv and edge-tts.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user