Fix storymode boolean checks and add TTS listing

pull/2364/head
kennydd0 2 months ago
parent 64bf647de9
commit 828fb37336

@ -6,6 +6,7 @@ from pathlib import Path
from subprocess import Popen from subprocess import Popen
from typing import NoReturn from typing import NoReturn
import argparse
from prawcore import ResponseException from prawcore import ResponseException
from reddit.subreddit import get_subreddit_threads from reddit.subreddit import get_subreddit_threads
@ -23,7 +24,7 @@ from video_creation.background import (
) )
from video_creation.final_video import make_final_video from video_creation.final_video import make_final_video
from video_creation.screenshot_downloader import get_screenshots_of_reddit_posts from video_creation.screenshot_downloader import get_screenshots_of_reddit_posts
from video_creation.voices import save_text_to_mp3 from video_creation.voices import save_text_to_mp3, TTSProviders
__VERSION__ = "3.3.0" __VERSION__ = "3.3.0"
@ -79,6 +80,20 @@ def shutdown() -> NoReturn:
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Reddit Video Maker Bot")
parser.add_argument(
"--list-tts",
action="store_true",
help="List available TTS providers and exit",
)
args = parser.parse_args()
if args.list_tts:
print_step("Available TTS Providers:")
for provider in TTSProviders:
print_substep(f"- {provider}")
sys.exit()
if sys.version_info.major != 3 or sys.version_info.minor not in [10, 11]: if sys.version_info.major != 3 or sys.version_info.minor not in [10, 11]:
print( print(
"Hey! Congratulations, you've made it so far (which is pretty rare with no Python 3.10). Unfortunately, this program only works on Python 3.10. Please install Python 3.10 and try again." "Hey! Congratulations, you've made it so far (which is pretty rare with no Python 3.10). Unfortunately, this program only works on Python 3.10. Please install Python 3.10 and try again."

@ -95,7 +95,7 @@ def get_subreddit_threads(POST_ID: str):
if submission is None: if submission is None:
return get_subreddit_threads(POST_ID) # submission already done. rerun return get_subreddit_threads(POST_ID) # submission already done. rerun
elif not submission.num_comments and settings.config["settings"]["storymode"] == "false": elif not submission.num_comments and not settings.config["settings"]["storymode"]:
print_substep("No comments found. Skipping.") print_substep("No comments found. Skipping.")
exit() exit()

@ -217,7 +217,7 @@ def make_final_video(
# Gather all audio clips # Gather all audio clips
audio_clips = list() audio_clips = list()
if number_of_clips == 0 and settings.config["settings"]["storymode"] == "false": if number_of_clips == 0 and not settings.config["settings"]["storymode"]:
print( print(
"No audio clips to gather. Please use a different TTS or post." "No audio clips to gather. Please use a different TTS or post."
) # This is to fix the TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' ) # This is to fix the TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

Loading…
Cancel
Save