diff --git a/main.py b/main.py index 5168aa3..c3d2f83 100755 --- a/main.py +++ b/main.py @@ -1,6 +1,8 @@ import time +from subprocess import Popen + from dotenv import load_dotenv -from os import system, getenv, name +from os import getenv, name from reddit.subreddit import get_subreddit_threads from utils.cleanup import cleanup from utils.console import print_markdown, print_step @@ -47,7 +49,7 @@ def run_many(times): print_step( f'on the {x}{("st" if x == 1 else ("nd" if x == 2 else ("rd" if x == 3 else "th")))} iteration of {times}') # correct 1st 2nd 3rd 4th 5th.... main() - system('cls' if name == 'nt' else 'clear') # clear terminal + Popen('cls' if name == 'nt' else 'clear', shell=True).wait() if __name__ == '__main__': diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 6eb4639..e6f5274 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -51,11 +51,14 @@ def get_subreddit_threads(): submission = check_done(submission) if submission is None: return get_subreddit_threads() # submission already done. rerun - print_substep(f"Video will be: {submission.title} :thumbsup:") - - print_substep( - f'subreddit thread is: {submission.title}\n(if you dont like this, you can change it by exiting and rerunning the program)') + upvotes = submission.score + ratio = submission.upvote_ratio * 100 + num_comments = submission.num_comments + print_substep(f"Video will be: {submission.title} :thumbsup:", style='bold green') + print_substep(f"Thread has " + str(upvotes) + " upvotes", style='bold blue') + print_substep(f"Thread has a upvote ratio of " + str(ratio) + "%", style='bold blue') + print_substep(f"Thread has " + str(num_comments) + " comments", style='bold blue') environ["VIDEO_TITLE"] = str(textify(submission.title)) # todo use global instend of env vars environ["VIDEO_ID"] = str(textify(submission.id)) try: diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index 6c910b8..6be00fc 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -2,6 +2,7 @@ import json from os import getenv from pathlib import Path +from playwright.async_api import async_playwright from playwright.sync_api import sync_playwright, ViewportSize from rich.progress import track