fixed 71c317da23 by removing match usage (3.10+ only)

optimized imports
pull/1145/head
Jason 2 years ago
parent 12482f4298
commit c10a5d3c2f

@ -39,12 +39,11 @@ The only original thing being done is the editing and gathering of all materials
1. Clone this repository
2. Run `pip install -r requirements.txt`
3. Run `python -m playwright install` and `python -m playwright install-deps`
**EXPERIMENTAL!!!!**
On MacOS and Linux (debian, arch, fedora and centos, and based on those), you can run an install script that will automatically install steps 1 to 3. (requires bash)
On macOS and Linux (debian, arch, fedora and centos, and based on those), you can run an install script that will automatically install steps 1 to 3. (requires bash)
`bash <(curl -sL https://raw.githubusercontent.com/elebumm/RedditVideoMakerBot/master/install.sh)`

@ -1,8 +1,10 @@
#!/usr/bin/env python3
import random
from utils import settings
from gtts import gTTS
from utils import settings
class GTTS:
def __init__(self):

@ -1,9 +1,11 @@
import base64
from utils import settings
import random
import requests
from requests.adapters import HTTPAdapter, Retry
from utils import settings
# from profanity_filter import ProfanityFilter
# pf = ProfanityFilter()
# Code by @JasonLovesDoggo

@ -1,9 +1,11 @@
#!/usr/bin/env python3
import random
import sys
from boto3 import Session
from botocore.exceptions import BotoCoreError, ClientError, ProfileNotFound
import sys
from utils import settings
import random
voices = [
"Brian",

@ -1,17 +1,18 @@
#!/usr/bin/env python3
import re
from pathlib import Path
from typing import Tuple
import re
# import sox
# from mutagen import MutagenError
# from mutagen.mp3 import MP3, HeaderNotFoundError
import translators as ts
from rich.progress import track
from moviepy.editor import AudioFileClip, CompositeAudioClip, concatenate_audioclips
from rich.progress import track
from utils import settings
from utils.console import print_step, print_substep
from utils.voice import sanitize_text
from utils import settings
DEFAULT_MAX_LENGTH: int = 50 # video length variable

@ -1,5 +1,7 @@
import random
import pyttsx3
from utils import settings

@ -1,6 +1,8 @@
import random
import requests
from requests.exceptions import JSONDecodeError
from utils import settings
from utils.voice import check_ratelimit

@ -1,18 +1,17 @@
#!/usr/bin/env python
import math
import re
from subprocess import Popen
import sys
from os import name
from subprocess import Popen
from prawcore import ResponseException
from reddit.subreddit import get_subreddit_threads
from utils.cleanup import cleanup
from utils.console import print_markdown, print_step, print_substep
from utils import settings
from utils.cleanup import cleanup
from utils.console import print_markdown, print_step
from utils.id import id
from utils.version import checkversion
from video_creation.background import (
download_background,
chop_background_video,
@ -76,6 +75,7 @@ def shutdown():
exit()
if __name__ == "__main__":
assert sys.version_info >= (3, 9), "Python 3.10 or higher is required"
config = settings.check_toml("utils/.config.template.toml", "config.toml")
config is False and exit()
try:

@ -1,11 +1,10 @@
import re
from prawcore.exceptions import ResponseException
from utils import settings
import praw
from praw.models import MoreComments
from prawcore.exceptions import ResponseException
from utils import settings
from utils.console import print_step, print_substep
from utils.subreddit import get_subreddit_undone
from utils.videos import check_done
@ -41,9 +40,8 @@ def get_subreddit_threads(POST_ID: str):
check_for_async=False,
)
except ResponseException as e:
match e.response.status_code:
case 401:
print("Invalid credentials - please check them in config.toml")
if e.response.status_code == 401:
print("Invalid credentials - please check them in config.toml")
except:
print("Something went wrong...")

@ -1,11 +1,12 @@
#!/usr/bin/env python3
import re
from rich.columns import Columns
from rich.console import Console
from rich.markdown import Markdown
from rich.padding import Padding
from rich.panel import Panel
from rich.text import Text
from rich.columns import Columns
import re
console = Console()

@ -1,10 +1,12 @@
import re
from utils.console import print_substep
def id(reddit_obj: dict):
"""
This function takes a reddit object and returns the post id
"""
id = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"])
print_substep(f"Thread ID is {id}", style="bold blue")
return id
return id

@ -1,12 +1,11 @@
#!/usr/bin/env python
import toml
from rich.console import Console
import re
from typing import Tuple, Dict
from utils.console import handle_input
import toml
from rich.console import Console
from utils.console import handle_input
console = Console()
config = dict # autocomplete

@ -1,4 +1,5 @@
import requests
from utils.console import print_step

@ -1,7 +1,6 @@
from __future__ import annotations
from ast import Str
import re
import re
from typing import Tuple
from PIL import ImageFont, Image, ImageDraw, ImageEnhance

@ -1,6 +1,5 @@
import json
import time
from typing import Dict
from praw.models import Submission

@ -1,7 +1,7 @@
import re
import sys
from datetime import datetime
import time as pytime
from datetime import datetime
from time import sleep
from requests import Response

@ -1,10 +1,9 @@
from pathlib import Path
import random
from random import randrange
import re
from pathlib import Path
from random import randrange
from typing import Any, Tuple
from moviepy.editor import VideoFileClip
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
from pytube import YouTube

@ -4,6 +4,7 @@ import os
import re
from os.path import exists
from typing import Tuple, Any
from moviepy.audio.AudioClip import concatenate_audioclips, CompositeAudioClip
from moviepy.audio.io.AudioFileClip import AudioFileClip
from moviepy.video.VideoClip import ImageClip
@ -13,11 +14,11 @@ from moviepy.video.io.VideoFileClip import VideoFileClip
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
from rich.console import Console
from utils import settings
from utils.cleanup import cleanup
from utils.console import print_step, print_substep
from utils.video import Video
from utils.videos import save_data
from utils import settings
console = Console()
W, H = 1080, 1920

@ -1,19 +1,17 @@
import json
from pathlib import Path
import re
from pathlib import Path
from typing import Dict
from utils import settings
from playwright.async_api import async_playwright # pylint: disable=unused-import
# do not remove the above line
import translators as ts
from playwright.sync_api import sync_playwright, ViewportSize
from rich.progress import track
import translators as ts
from utils import settings
from utils.console import print_step, print_substep
# do not remove the above line
storymode = False

@ -1,19 +1,18 @@
#!/usr/bin/env python
from typing import Dict, Tuple
from typing import Tuple
from rich.console import Console
from TTS.engine_wrapper import TTSEngine
from TTS.GTTS import GTTS
from TTS.streamlabs_polly import StreamlabsPolly
from TTS.aws_polly import AWSPolly
from TTS.TikTok import TikTok
from TTS.aws_polly import AWSPolly
from TTS.engine_wrapper import TTSEngine
from TTS.pyttsx import pyttsx
from TTS.streamlabs_polly import StreamlabsPolly
from utils import settings
from utils.console import print_table, print_step
console = Console()
TTSProviders = {

Loading…
Cancel
Save