Allow TTsChoice and ALLOW_NSFW to be blank

All these changes to the .env file make it annoying to keep updating. This allows the TTsChoice and ALLOW_NSFW variables to be left blank in the event that someone doesn't update the .env file. Also, videos.json in the .gitignore was not seen by GH Desktop, and it kept wanting to push that too. I made a change in the .gitignore.
pull/549/head
Owen Gaspard 3 years ago
parent 9ba6dab73c
commit ed86199141

2
.gitignore vendored

@ -169,4 +169,4 @@ results/*
reddit-bot-351418-5560ebc49cac.json
/.idea
*.pyc
/video_creation/data/videos.json
video_creation/data/videos.json

@ -12,7 +12,11 @@ CHOICE_DIR = {"tiktok": TikTok, "gtts": GTTS, 'polly': POLLY}
class TTS:
def __new__(cls):
load_dotenv()
CHOICE = getenv("TTsChoice").casefold()
try:
CHOICE = getenv("TTsChoice").casefold()
except AttributeError:
print_substep("None defined. Defaulting to 'polly.'")
CHOICE = "polly"
valid_keys = [key.lower() for key in CHOICE_DIR.keys()]
if CHOICE not in valid_keys:
raise ValueError(

@ -14,8 +14,12 @@ def get_subreddit_undone(submissions: List, subreddit):
if already_done(done_videos, submission):
continue
if submission.over_18:
if getenv("ALLOW_NSFW").casefold() == "false":
print_substep("NSFW Post Detected. Skipping...")
try:
if getenv("ALLOW_NSFW").casefold() == "false":
print_substep("NSFW Post Detected. Skipping...")
continue
except AttributeError:
print_substep("NSFW settings not defined. Skipping NSFW post...")
continue
return submission
print('all submissions have been done going by top submission order')

Loading…
Cancel
Save