fix: delete file if size is 0 #80
This commit is contained in:
parent
cf1feea870
commit
756e2307ec
11
mumbleBot.py
11
mumbleBot.py
@ -462,10 +462,13 @@ class MumbleBot:
|
|||||||
self.log.info("bot: download attempts %d / %d" % (i+1, attempts))
|
self.log.info("bot: download attempts %d / %d" % (i+1, attempts))
|
||||||
try:
|
try:
|
||||||
ydl.extract_info(url)
|
ydl.extract_info(url)
|
||||||
if os.path.exists(mp3) and os.stat(mp3).st_size > 0:
|
if os.path.exists(mp3):
|
||||||
music['ready'] = "yes"
|
if os.stat(mp3).st_size > 0:
|
||||||
download_succeed = True
|
music['ready'] = "yes"
|
||||||
break
|
download_succeed = True
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
os.remove(mp3)
|
||||||
else:
|
else:
|
||||||
self.log.error("bot: download failed: file not existed or file size is 0.")
|
self.log.error("bot: download failed: file not existed or file size is 0.")
|
||||||
except:
|
except:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user