fix: fixed cleanup.py function not actually removing temporary files causing storage clutter

fix: fixed the last 2 print_step functions not showing up after successful video creation in final_video.py
  explanation: final_video.py is the last function being called and exits too quickly for the print functions to show up
pull/1818/head
tumpa02 2 years ago
parent ed97ae4ebb
commit 1d1d2b706c

@ -13,7 +13,7 @@ def cleanup(reddit_id) -> int:
Returns:
int: How many files were deleted
"""
directory = f"../assets/temp/{reddit_id}/"
directory = f"assets/temp/{reddit_id}/"
if exists(directory):
shutil.rmtree(directory)

@ -1,6 +1,7 @@
import multiprocessing
import os
import re
import shutil
import tempfile
import threading
import time
@ -436,9 +437,11 @@ def make_final_video(
old_percentage = pbar.n
pbar.update(100 - old_percentage)
pbar.close()
save_data(subreddit, filename + ".mp4", title, idx, background_config["video"][2])
print_step("Removing temporary files 🗑")
cleanups = cleanup(reddit_id)
print_substep(f"Removed {cleanups} temporary files 🗑")
cleanup(reddit_id)
print_step("Done! 🎉 The video is in the results folder 📁")
time.sleep(1) # Prevents the last 2 print_step functions from not showing up

Loading…
Cancel
Save