everything does indeed work!

pull/418/head
Jason 3 years ago
parent 016feae60b
commit 9f6a5e6a1f

@ -1,3 +1,4 @@
from utils.cleanup import cleanup
from utils.console import print_markdown
import time
from reddit.subreddit import get_subreddit_threads
@ -12,6 +13,7 @@ print_markdown(
time.sleep(2)
def main():
reddit_object = get_subreddit_threads()
@ -23,4 +25,9 @@ def main():
if __name__ == '__main__':
main()
try:
main()
except KeyboardInterrupt:
print_markdown("## Clearing temp files")
cleanup()
exit()

@ -7,10 +7,12 @@ def cleanup() -> int:
count += len(files)
for f in files:
os.remove(f)
for file in os.listdir('./assets/temp/mp4'):
count += 1
os.remove('./assets/temp/mp4/' + file)
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
os.remove('./assets/temp/mp3/' + file)

@ -5,7 +5,7 @@ from random import randrange
from pytube import YouTube
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
from moviepy.editor import VideoFileClip
from rich.progress import track
from rich.progress import track, Progress
from utils.console import print_step, print_substep
@ -26,14 +26,20 @@ def download_background():
("https://www.youtube.com/watch?v=n_Dv4JMiwK8", "parkour.mp4", 'bbswitzer'),
# note: make sure the file name doesn't include a - in it
("https://www.youtube.com/watch?v=2X9QGY__0II", "rocket_league.mp4", 'Orbital Gameplay'), ]
print(listdir('./assets/backgrounds'), 'podsods', len(background_options))
if listdir('./assets/backgrounds') != len(background_options):
print_step("We need to download the backgrounds videos. they are fairly large but it's only done once. 😎")
print_substep("Downloading the backgrounds video... please be patient 🙏 ")
print_step("We need to download the backgnrounds videos. they are fairly large but it's only done once. 😎")
print_substep("Downloading the backgrounds videos... please be patient 🙏 ")
with Progress() as progress:
download_task = progress.add_task("[green]Downloading...", total=2)
for uri, filename, credit in background_options:
print_substep(f"Downloading {filename} from {uri}")
YouTube(uri).streams.filter(res="720p").first().download("assets/backgrounds",
filename=f"{credit}-{filename}")
progress.update(download_task, advance=1)
for uri, filename, credit in track(background_options, description="Downloading..."):
print_substep(f"Downloading {filename} from {uri}")
YouTube(uri).streams.filter(res="720p").first().download("assets/backgrounds",
filename=f"{credit}-{filename}")
print_substep("Background videos downloaded successfully! 🎉", style="bold green")

Loading…
Cancel
Save