Merge branch 'develop' into master

pull/2041/head
Cyteon 1 year ago committed by GitHub
commit 853ba49b3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -205,7 +205,7 @@
<select name="background_choice" class="form-select" data-toggle="tooltip" <select name="background_choice" class="form-select" data-toggle="tooltip"
data-original-title='Sets the background of the video'> data-original-title='Sets the background of the video'>
<option value=" ">Random Video</option> <option value=" ">Random Video</option>
{% for background in checks["background_choice"]["options"][1:] %} {% for background in checks["background_video"]["options"][1:] %}
<option value="{{background}}">{{background}}</option> <option value="{{background}}">{{background}}</option>
{% endfor %} {% endfor %}
</select> </select>
@ -618,4 +618,4 @@
}); });
</script> </script>
{% endblock %} {% endblock %}

@ -14,14 +14,12 @@ from utils import settings
from utils.console import print_step, print_substep from utils.console import print_step, print_substep
from utils.voice import sanitize_text from utils.voice import sanitize_text
DEFAULT_MAX_LENGTH: int = ( DEFAULT_MAX_LENGTH: int = (
50 # Video length variable, edit this on your own risk. It should work, but it's not supported 50 # Video length variable, edit this on your own risk. It should work, but it's not supported
) )
class TTSEngine: class TTSEngine:
"""Calls the given TTS engine to reduce code duplication and allow multiple TTS engines. """Calls the given TTS engine to reduce code duplication and allow multiple TTS engines.
Args: Args:

@ -43,8 +43,8 @@ class StreamlabsPolly:
f"Please set the config variable STREAMLABS_POLLY_VOICE to a valid voice. options are: {voices}" f"Please set the config variable STREAMLABS_POLLY_VOICE to a valid voice. options are: {voices}"
) )
voice = str(settings.config["settings"]["tts"]["streamlabs_polly_voice"]).capitalize() voice = str(settings.config["settings"]["tts"]["streamlabs_polly_voice"]).capitalize()
headers = {"referer": "https://streamlabs.com"}
body = {"voice": voice, "text": text, "service": "polly"} body = {"voice": voice, "text": text, "service": "polly"}
headers = {"Referer" : "https://streamlabs.com/" }
response = requests.post(self.url, headers=headers, data=body) response = requests.post(self.url, headers=headers, data=body)
if not check_ratelimit(response): if not check_ratelimit(response):
self.run(text, filepath, random_voice) self.run(text, filepath, random_voice)

@ -7,11 +7,13 @@ from subprocess import Popen
from typing import NoReturn from typing import NoReturn
from prawcore import ResponseException from prawcore import ResponseException
from utils.console import print_substep
from reddit.subreddit import get_subreddit_threads from reddit.subreddit import get_subreddit_threads
from utils import settings from utils import settings
from utils.cleanup import cleanup from utils.cleanup import cleanup
from utils.console import print_markdown, print_step from utils.console import print_markdown, print_step
from utils.console import print_substep
from utils.ffmpeg_install import ffmpeg_install
from utils.id import id from utils.id import id
from utils.version import checkversion from utils.version import checkversion
from video_creation.background import ( from video_creation.background import (
@ -23,7 +25,6 @@ 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
from utils.ffmpeg_install import ffmpeg_install
__VERSION__ = "3.2.1" __VERSION__ = "3.2.1"

@ -1,18 +1,16 @@
import re import re
from prawcore.exceptions import ResponseException
from utils import settings
import praw import praw
from praw.models import MoreComments from praw.models import MoreComments
from prawcore.exceptions import ResponseException from prawcore.exceptions import ResponseException
from utils import settings
from utils.ai_methods import sort_by_similarity
from utils.console import print_step, print_substep from utils.console import print_step, print_substep
from utils.posttextparser import posttextparser
from utils.subreddit import get_subreddit_undone from utils.subreddit import get_subreddit_undone
from utils.videos import check_done from utils.videos import check_done
from utils.voice import sanitize_text from utils.voice import sanitize_text
from utils.posttextparser import posttextparser
from utils.ai_methods import sort_by_similarity
def get_subreddit_threads(POST_ID: str): def get_subreddit_threads(POST_ID: str):

@ -1,6 +1,6 @@
boto3==1.26.142 boto3==1.26.142
botocore==1.29.142 botocore==1.29.142
gTTS==2.3.2 gTTS==2.5.1
moviepy==1.0.3 moviepy==1.0.3
playwright==1.34.0 playwright==1.34.0
praw==7.7.0 praw==7.7.0
@ -10,14 +10,14 @@ rich==13.4.1
toml==0.10.2 toml==0.10.2
translators==5.7.6 translators==5.7.6
pyttsx3==2.90 pyttsx3==2.90
Pillow==9.5.0 Pillow==10.2.0
tomlkit==0.11.8 tomlkit==0.11.8
Flask==2.3.3 Flask==2.3.3
clean-text==0.6.0 clean-text==0.6.0
unidecode==1.3.6 unidecode==1.3.8
spacy==3.5.3 spacy==3.5.3
torch==2.0.1 torch==2.2.0
transformers==4.29.2 transformers==4.37.2
ffmpeg-python==0.2.0 ffmpeg-python==0.2.0
elevenlabs==0.2.17 elevenlabs==0.2.17
yt-dlp==2023.7.6 yt-dlp==2023.7.6

@ -44,7 +44,7 @@ background_thumbnail_font_color = { optional = true, default = "255,255,255", ex
[settings.tts] [settings.tts]
voice_choice = { optional = false, default = "tiktok", options = ["elevenlabs", "streamlabspolly", "tiktok", "googletranslate", "awspolly", "pyttsx", ], example = "tiktok", explanation = "The voice platform used for TTS generation. " } voice_choice = { optional = false, default = "tiktok", options = ["elevenlabs", "streamlabspolly", "tiktok", "googletranslate", "awspolly", "pyttsx", ], example = "tiktok", explanation = "The voice platform used for TTS generation. " }
random_voice = { optional = false, default = true, example = true, options = [true, false,], explanation = "Randomizes the voice used for each comment" } random_voice = { optional = false, type = "bool", default = true, example = true, options = [true, false,], explanation = "Randomizes the voice used for each comment" }
elevenlabs_voice_name = { optional = false, default = "Bella", example = "Bella", explanation = "The voice used for elevenlabs", options = ["Adam", "Antoni", "Arnold", "Bella", "Domi", "Elli", "Josh", "Rachel", "Sam", ] } elevenlabs_voice_name = { optional = false, default = "Bella", example = "Bella", explanation = "The voice used for elevenlabs", options = ["Adam", "Antoni", "Arnold", "Bella", "Domi", "Elli", "Josh", "Rachel", "Sam", ] }
elevenlabs_api_key = { optional = true, example = "21f13f91f54d741e2ae27d2ab1b99d59", explanation = "Elevenlabs API key" } elevenlabs_api_key = { optional = true, example = "21f13f91f54d741e2ae27d2ab1b99d59", explanation = "Elevenlabs API key" }
aws_polly_voice = { optional = false, default = "Matthew", example = "Matthew", explanation = "The voice used for AWS Polly" } aws_polly_voice = { optional = false, default = "Matthew", example = "Matthew", explanation = "The voice used for AWS Polly" }

@ -1,6 +1,6 @@
import numpy as np import numpy as np
from transformers import AutoTokenizer, AutoModel
import torch import torch
from transformers import AutoTokenizer, AutoModel
# Mean Pooling - Take attention mask into account for correct averaging # Mean Pooling - Take attention mask into account for correct averaging

@ -1,6 +1,6 @@
import os import os
from os.path import exists
import shutil import shutil
from os.path import exists
def _listdir(d): # listdir with full path def _listdir(d): # listdir with full path

@ -1,7 +1,8 @@
import zipfile
import requests
import os import os
import subprocess import subprocess
import zipfile
import requests
def ffmpeg_install_windows(): def ffmpeg_install_windows():
@ -39,7 +40,10 @@ def ffmpeg_install_windows():
# Rename and move files # Rename and move files
os.rename(f"{ffmpeg_extracted_folder}-6.0-full_build", ffmpeg_extracted_folder) os.rename(f"{ffmpeg_extracted_folder}-6.0-full_build", ffmpeg_extracted_folder)
for file in os.listdir(os.path.join(ffmpeg_extracted_folder, "bin")): for file in os.listdir(os.path.join(ffmpeg_extracted_folder, "bin")):
os.rename(os.path.join(ffmpeg_extracted_folder, "bin", file), os.path.join(".", file)) os.rename(
os.path.join(ffmpeg_extracted_folder, "bin", file),
os.path.join(".", file),
)
os.rmdir(os.path.join(ffmpeg_extracted_folder, "bin")) os.rmdir(os.path.join(ffmpeg_extracted_folder, "bin"))
for file in os.listdir(os.path.join(ffmpeg_extracted_folder, "doc")): for file in os.listdir(os.path.join(ffmpeg_extracted_folder, "doc")):
os.remove(os.path.join(ffmpeg_extracted_folder, "doc", file)) os.remove(os.path.join(ffmpeg_extracted_folder, "doc", file))
@ -101,7 +105,10 @@ def ffmpeg_install():
try: try:
# Try to run the FFmpeg command # Try to run the FFmpeg command
subprocess.run( subprocess.run(
["ffmpeg", "-version"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE ["ffmpeg", "-version"],
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
) )
except FileNotFoundError as e: except FileNotFoundError as e:
# Check if there's ffmpeg.exe in the current directory # Check if there's ffmpeg.exe in the current directory

@ -1,9 +1,10 @@
import os
import re import re
import textwrap import textwrap
import os
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont
from rich.progress import track from rich.progress import track
from TTS.engine_wrapper import process_text from TTS.engine_wrapper import process_text

@ -1,6 +1,7 @@
import re import re
from typing import Tuple, Dict
from pathlib import Path from pathlib import Path
from typing import Tuple, Dict
import toml import toml
from rich.console import Console from rich.console import Console

@ -2,8 +2,8 @@ import json
from os.path import exists from os.path import exists
from utils import settings from utils import settings
from utils.console import print_substep
from utils.ai_methods import sort_by_similarity from utils.ai_methods import sort_by_similarity
from utils.console import print_substep
def get_subreddit_undone(submissions: list, subreddit, times_checked=0, similarity_scores=None): def get_subreddit_undone(submissions: list, subreddit, times_checked=0, similarity_scores=None):

@ -4,10 +4,10 @@ import time as pytime
from datetime import datetime from datetime import datetime
from time import sleep from time import sleep
from cleantext import clean
from requests import Response from requests import Response
from utils import settings from utils import settings
from cleantext import clean
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
from datetime import timezone from datetime import timezone

@ -5,11 +5,12 @@ from pathlib import Path
from random import randrange from random import randrange
from typing import Any, Tuple, Dict from typing import Any, Tuple, Dict
import yt_dlp
from moviepy.editor import VideoFileClip, AudioFileClip from moviepy.editor import VideoFileClip, AudioFileClip
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
from utils import settings from utils import settings
from utils.console import print_step, print_substep from utils.console import print_step, print_substep
import yt_dlp
def load_background_options(): def load_background_options():

@ -1,9 +1,12 @@
import multiprocessing import multiprocessing
import os import os
import re import re
import tempfile
import threading
import time
from os.path import exists # Needs to be imported specifically from os.path import exists # Needs to be imported specifically
from typing import Final from typing import Final
from typing import Tuple, Any, Dict from typing import Tuple, Dict
import ffmpeg import ffmpeg
import translators import translators
@ -11,15 +14,11 @@ from PIL import Image
from rich.console import Console from rich.console import Console
from rich.progress import track from rich.progress import track
from utils import settings
from utils.cleanup import cleanup from utils.cleanup import cleanup
from utils.console import print_step, print_substep from utils.console import print_step, print_substep
from utils.thumbnail import create_thumbnail from utils.thumbnail import create_thumbnail
from utils.videos import save_data from utils.videos import save_data
from utils import settings
import tempfile
import threading
import time
console = Console() console = Console()

@ -4,7 +4,6 @@ from pathlib import Path
from typing import Dict, Final from typing import Dict, Final
import translators import translators
from playwright.async_api import async_playwright # pylint: disable=unused-import
from playwright.sync_api import ViewportSize, sync_playwright from playwright.sync_api import ViewportSize, sync_playwright
from rich.progress import track from rich.progress import track
@ -12,7 +11,6 @@ from utils import settings
from utils.console import print_step, print_substep from utils.console import print_step, print_substep
from utils.imagenarator import imagemaker from utils.imagenarator import imagemaker
from utils.playwright import clear_cookie_by_name from utils.playwright import clear_cookie_by_name
from utils.videos import save_data from utils.videos import save_data
__all__ = ["download_screenshots_of_reddit_posts"] __all__ = ["download_screenshots_of_reddit_posts"]

@ -5,9 +5,9 @@ from rich.console import Console
from TTS.GTTS import GTTS from TTS.GTTS import GTTS
from TTS.TikTok import TikTok from TTS.TikTok import TikTok
from TTS.aws_polly import AWSPolly from TTS.aws_polly import AWSPolly
from TTS.elevenlabs import elevenlabs
from TTS.engine_wrapper import TTSEngine from TTS.engine_wrapper import TTSEngine
from TTS.pyttsx import pyttsx from TTS.pyttsx import pyttsx
from TTS.elevenlabs import elevenlabs
from TTS.streamlabs_polly import StreamlabsPolly from TTS.streamlabs_polly import StreamlabsPolly
from utils import settings from utils import settings
from utils.console import print_table, print_step from utils.console import print_table, print_step

Loading…
Cancel
Save