pull/418/head
parent
f8c340f612
commit
80653eab7c
@ -1,20 +1,23 @@
|
|||||||
import os
|
import os
|
||||||
|
from os.path import exists
|
||||||
|
|
||||||
|
|
||||||
def cleanup() -> int:
|
def cleanup() -> int:
|
||||||
count = 0
|
if exists('./assets/temp'):
|
||||||
files = [f for f in os.listdir('.') if f.endswith('.mp4') and 'temp' in f.lower()]
|
count = 0
|
||||||
count += len(files)
|
files = [f for f in os.listdir('.') if f.endswith('.mp4') and 'temp' in f.lower()]
|
||||||
for f in files:
|
count += len(files)
|
||||||
os.remove(f)
|
for f in files:
|
||||||
try:
|
os.remove(f)
|
||||||
for file in os.listdir('./assets/temp/mp4'):
|
try:
|
||||||
|
for file in os.listdir('./assets/temp/mp4'):
|
||||||
|
count += 1
|
||||||
|
os.remove('./assets/temp/mp4/' + file)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
for file in os.listdir('./assets/temp/mp3'):
|
||||||
count += 1
|
count += 1
|
||||||
os.remove('./assets/temp/mp4/' + file)
|
os.remove('./assets/temp/mp3/' + file)
|
||||||
except FileNotFoundError:
|
return count
|
||||||
pass
|
return 0
|
||||||
for file in os.listdir('./assets/temp/mp3'):
|
|
||||||
count += 1
|
|
||||||
os.remove('./assets/temp/mp3/' + file)
|
|
||||||
return count
|
|
||||||
|
|
||||||
|
Loading…
Reference in new issue