Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76fb733

Browse files
committed
fix read if the sound file size is 0
1 parent b7bb2da commit 76fb733

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

recite/sound.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def download(url, path):
3131
return False
3232
raise e
3333
def play(f):
34+
if os.path.getsize(f) == 0:
35+
return
3436
if sys.platform == 'darwin':
3537
return os.system('afplay %s' % f)
3638
try:
@@ -44,6 +46,8 @@ def play(f):
4446
pass
4547

4648
def sound(w):
49+
if w == '':
50+
return
4751
if not os.path.exists(sound_dir):
4852
os.mkdir(sound_dir)
4953
urls = [

0 commit comments

Comments
 (0)