From bafe8c3616d003076943d69db99d9ef7ff3b3f6e Mon Sep 17 00:00:00 2001 From: null3000 <76852813+null3000@users.noreply.github.com> Date: Tue, 7 Jun 2022 01:52:21 +0200 Subject: [PATCH] Update screenshot_downloader.py --- video_creation/screenshot_downloader.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index d3d32ef..1e1ae21 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -3,6 +3,8 @@ from pathlib import Path from rich.progress import track from utils.console import print_step, print_substep import json +from rich.console import Console +console = Console() def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme): @@ -43,9 +45,12 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme): ) for idx, comment in track( - enumerate(reddit_object["comments"]), "Downloading screenshots..." + enumerate(reddit_object["comments"]) ): + #allow user to see what comment is being saved + print_substep(f"Downloading screenshot {idx + 1}") + # Stop if we have reached the screenshot_num if idx >= screenshot_num: break @@ -57,6 +62,7 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme): page.locator(f"#t1_{comment['comment_id']}").screenshot( path=f"assets/png/comment_{idx}.png" ) - - print_substep("Screenshots downloaded Successfully.", - style="bold green") + + #let user know that the screenshots are done + console.log(f"[bold green]Saved {idx + 1} screenshots.") +