fix: fixed cleanup.py util not returning the number of deleted files

fix: returned print statement in final_video.py to showcase the number of deleted files
pull/1818/head
tumpa02 2 years ago
parent c92a47bc15
commit 08ee274dc8

@ -14,7 +14,13 @@ def cleanup(reddit_id) -> int:
int: How many files were deleted int: How many files were deleted
""" """
directory = f"assets/temp/{reddit_id}/" directory = f"assets/temp/{reddit_id}/"
deleted_files_count = 0
if exists(directory): if exists(directory):
# Count the number of files before deleting
for root, dirs, files in os.walk(directory):
deleted_files_count += len(files)
shutil.rmtree(directory) shutil.rmtree(directory)
return 1 return deleted_files_count

@ -441,6 +441,7 @@ def make_final_video(
save_data(subreddit, filename + ".mp4", title, idx, background_config["video"][2]) save_data(subreddit, filename + ".mp4", title, idx, background_config["video"][2])
print_step("Removing temporary files 🗑") print_step("Removing temporary files 🗑")
cleanup(reddit_id) cleanups = cleanup(reddit_id)
print_substep(f"Removed {cleanups} temporary files 🗑")
print_step("Done! 🎉 The video is in the results folder 📁") print_step("Done! 🎉 The video is in the results folder 📁")
time.sleep(1) # Prevents the last 2 print_step functions from not showing up time.sleep(1) # Prevents the last 2 print_step functions from not showing up

Loading…
Cancel
Save