From 2b1f7183d40e8fd6779a85bdb234229bdc8d774f Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 7 Jun 2022 10:28:40 -0400 Subject: [PATCH] closes #61 fix: perm removed praw async error --- .env.template | 2 +- main.py | 13 ++++++------- reddit/subreddit.py | 2 +- video_creation/data/.gitignore | 1 + 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.env.template b/.env.template index 6b82028..a99bcc9 100644 --- a/.env.template +++ b/.env.template @@ -14,7 +14,7 @@ THEME="LIGHT" # set to an int e.g. 1 or 29 and leave blank for once TIMES_TO_RUN="" MAX_COMMENT_LENGTH="500" -# Range is 0 -> 1 recommended around 0.8-1 +# Range is 0 -> 1 recommended around 0.8-0.9 OPACITY="" # see TTSwrapper.py for all valid options diff --git a/main.py b/main.py index 2ebb907..8fc880c 100755 --- a/main.py +++ b/main.py @@ -1,8 +1,6 @@ -import os import time - from dotenv import load_dotenv - +from os import system, getenv, name from reddit.subreddit import get_subreddit_threads from utils.cleanup import cleanup from utils.console import print_markdown, print_step @@ -36,16 +34,17 @@ def main(): def run_many(times): for x in range(times): + x = x + 1 print_step( - f'on the {x}{("st" if x == 1 else ("nd" if x == 2 else ("rd" if x == 3 else "th")))} iteration') # correct 1st 2nd 3rd 4th 5th.... - os.system('cls' if os.name == 'nt' else 'clear') # clear terminal + 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 if __name__ == '__main__': try: - if os.getenv('TIMES_TO_RUN'): - run_many(int(os.getenv('TIMES_TO_RUN'))) + if getenv('TIMES_TO_RUN'): + run_many(int(getenv('TIMES_TO_RUN'))) else: main() except KeyboardInterrupt: diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 30ff8bd..6eb4639 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -31,7 +31,7 @@ def get_subreddit_threads(): passkey = getenv("REDDIT_PASSWORD") reddit = praw.Reddit(client_id=getenv("REDDIT_CLIENT_ID"), client_secret=getenv("REDDIT_CLIENT_SECRET"), user_agent="Accessing Reddit threads", username=getenv("REDDIT_USERNAME"), - passkey=passkey, ) + passkey=passkey, check_for_async=False,) """ Ask user for subreddit input """ diff --git a/video_creation/data/.gitignore b/video_creation/data/.gitignore index f96efd4..a8731e5 100644 --- a/video_creation/data/.gitignore +++ b/video_creation/data/.gitignore @@ -1 +1,2 @@ videos.json + #todo add videos on github