mirror of
https://github.com/Escartem/AnimeWwise.git
synced 2026-06-12 12:50:27 +08:00
don't create folder if empty
This commit is contained in:
12
extract.py
12
extract.py
@@ -252,8 +252,10 @@ def main():
|
|||||||
|
|
||||||
# prepare folders
|
# prepare folders
|
||||||
os.makedirs(path(f"output/{filename}"), exist_ok=True)
|
os.makedirs(path(f"output/{filename}"), exist_ok=True)
|
||||||
os.makedirs(path("temp/new_files"), exist_ok=True)
|
if len(new_files) > 0:
|
||||||
os.makedirs(path("temp/changed_files"), exist_ok=True)
|
os.makedirs(path("temp/new_files"), exist_ok=True)
|
||||||
|
if len(changed_files) > 0:
|
||||||
|
os.makedirs(path("temp/changed_files"), exist_ok=True)
|
||||||
|
|
||||||
# split files into corresponding folder
|
# split files into corresponding folder
|
||||||
for file in new_files:
|
for file in new_files:
|
||||||
@@ -264,8 +266,10 @@ def main():
|
|||||||
|
|
||||||
# move them to output
|
# move them to output
|
||||||
final_path = f"output/{filename}"
|
final_path = f"output/{filename}"
|
||||||
shutil.move("temp/new_files", f"{final_path}/new_files")
|
if len(new_files) > 0:
|
||||||
shutil.move("temp/changed_files", f"{final_path}/changed_files")
|
shutil.move("temp/new_files", f"{final_path}/new_files")
|
||||||
|
if len(changed_files) > 0:
|
||||||
|
shutil.move("temp/changed_files", f"{final_path}/changed_files")
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
shutil.rmtree("temp/mp3")
|
shutil.rmtree("temp/mp3")
|
||||||
|
|||||||
Reference in New Issue
Block a user