added stats

pull/418/head
Jason 3 years ago
parent ad2a043aad
commit 9ba4500c27

@ -1,6 +1,8 @@
import time import time
from subprocess import Popen
from dotenv import load_dotenv from dotenv import load_dotenv
from os import system, getenv, name from os import getenv, name
from reddit.subreddit import get_subreddit_threads from reddit.subreddit import get_subreddit_threads
from utils.cleanup import cleanup from utils.cleanup import cleanup
from utils.console import print_markdown, print_step from utils.console import print_markdown, print_step
@ -47,7 +49,7 @@ def run_many(times):
print_step( 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.... 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() main()
system('cls' if name == 'nt' else 'clear') # clear terminal Popen('cls' if name == 'nt' else 'clear', shell=True).wait()
if __name__ == '__main__': if __name__ == '__main__':

@ -51,11 +51,14 @@ def get_subreddit_threads():
submission = check_done(submission) submission = check_done(submission)
if submission is None: if submission is None:
return get_subreddit_threads() # submission already done. rerun return get_subreddit_threads() # submission already done. rerun
print_substep(f"Video will be: {submission.title} :thumbsup:") upvotes = submission.score
ratio = submission.upvote_ratio * 100
print_substep( num_comments = submission.num_comments
f'subreddit thread is: {submission.title}\n(if you dont like this, you can change it by exiting and rerunning the program)')
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_TITLE"] = str(textify(submission.title)) # todo use global instend of env vars
environ["VIDEO_ID"] = str(textify(submission.id)) environ["VIDEO_ID"] = str(textify(submission.id))
try: try:

@ -2,6 +2,7 @@ import json
from os import getenv from os import getenv
from pathlib import Path from pathlib import Path
from playwright.async_api import async_playwright
from playwright.sync_api import sync_playwright, ViewportSize from playwright.sync_api import sync_playwright, ViewportSize
from rich.progress import track from rich.progress import track

Loading…
Cancel
Save