fixed the typehiting that @HallowedDust5 broke for py versions < 3.9

pull/798/head
Jason 3 years ago
parent 89f4644ce9
commit 90be9e09b3

@ -2,6 +2,7 @@ import json
import os import os
import time import time
from os import getenv from os import getenv
from typing import Dict
from praw.models import Submission from praw.models import Submission
@ -9,16 +10,16 @@ from utils.console import print_step
def check_done( def check_done(
redditobj: dict[str], redditobj: Dict[str],
) -> Submission: ) -> Submission:
# don't set this to be run anyplace that isn't subreddit.py bc of inspect stack # don't set this to be run anyplace that isn't subreddit.py bc of inspect stack
"""Checks if the chosen post has already been generated """Checks if the chosen post has already been generated
Args: Args:
redditobj (dict[str]): Reddit object gotten from reddit/subreddit.py redditobj (Dict[str]): Reddit object gotten from reddit/subreddit.py
Returns: Returns:
dict[str]|None: Reddit object in args Dict[str]|None: Reddit object in args
""" """
with open("./video_creation/data/videos.json", "r", encoding="utf-8") as done_vids_raw: with open("./video_creation/data/videos.json", "r", encoding="utf-8") as done_vids_raw:

@ -3,6 +3,7 @@ import multiprocessing
import os import os
import re import re
from os.path import exists from os.path import exists
from typing import Dict
from moviepy.editor import ( from moviepy.editor import (
VideoFileClip, VideoFileClip,
@ -25,12 +26,13 @@ console = Console()
W, H = 1080, 1920 W, H = 1080, 1920
def make_final_video(number_of_clips: int, length: int, reddit_obj: dict[str]): def make_final_video(number_of_clips: int, length: int, reddit_obj: Dict[str]):
"""Gathers audio clips, gathers all screenshots, stitches them together and saves the final video to assets/temp """Gathers audio clips, gathers all screenshots, stitches them together and saves the final video to assets/temp
Args: Args:
number_of_clips (int): Index to end at when going through the screenshots number_of_clips (int): Index to end at when going through the screenshots
length (int): Length of the video length (int): Length of the video
reddit_obj (Dict[str]): The reddit object that contains the posts to read.
""" """
print_step("Creating the final video 🎥") print_step("Creating the final video 🎥")
VideoFileClip.reW = lambda clip: clip.resize(width=W) VideoFileClip.reW = lambda clip: clip.resize(width=W)

@ -2,6 +2,7 @@ import json
import os import os
from os import getenv from os import getenv
from pathlib import Path from pathlib import Path
from typing import Dict
from playwright.async_api import async_playwright # pylint: disable=unused-import from playwright.async_api import async_playwright # pylint: disable=unused-import
@ -16,11 +17,11 @@ from utils.console import print_step, print_substep
storymode = False storymode = False
def download_screenshots_of_reddit_posts(reddit_object: dict[str], screenshot_num: int): def download_screenshots_of_reddit_posts(reddit_object: Dict[str], screenshot_num: int):
"""Downloads screenshots of reddit posts as seen on the web. Downloads to assets/temp/png """Downloads screenshots of reddit posts as seen on the web. Downloads to assets/temp/png
Args: Args:
reddit_object (dict[str]): Reddit object received from reddit/subreddit.py reddit_object (Dict[str]): Reddit object received from reddit/subreddit.py
screenshot_num (int): Number of screenshots to downlaod screenshot_num (int): Number of screenshots to downlaod
""" """

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
from typing import Dict, Tuple
from rich.console import Console from rich.console import Console
@ -23,7 +24,7 @@ TTSProviders = {
} }
def save_text_to_mp3(reddit_obj: dict[str]) -> tuple[int, int]: def save_text_to_mp3(reddit_obj: Dict[str]) -> Tuple[int, int]:
"""Saves text to MP3 files. """Saves text to MP3 files.
Args: Args:

Loading…
Cancel
Save