fix: added a check in cleanup.py to see if the assets folder exists before clearing it

pull/418/head
Jason 3 years ago
parent f8c340f612
commit 80653eab7c

@ -1,7 +1,9 @@
import os import os
from os.path import exists
def cleanup() -> int: def cleanup() -> int:
if exists('./assets/temp'):
count = 0 count = 0
files = [f for f in os.listdir('.') if f.endswith('.mp4') and 'temp' in f.lower()] files = [f for f in os.listdir('.') if f.endswith('.mp4') and 'temp' in f.lower()]
count += len(files) count += len(files)
@ -17,4 +19,5 @@ def cleanup() -> int:
count += 1 count += 1
os.remove('./assets/temp/mp3/' + file) os.remove('./assets/temp/mp3/' + file)
return count return count
return 0

Loading…
Cancel
Save