Skip to content

Commit c68c580

Browse files
Merge pull request #2060 from elebumm/develop
Update 3.3.0
2 parents 340762e + 6b474b4 commit c68c580

29 files changed

+214
-119
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
steps:
4141
- name: Checkout repository
42-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL
Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,35 @@
33
# Othewrwise, Black is run and its changes are committed back to the incoming pull request.
44
# https://github.com/cclauss/autoblack
55

6-
name: autoblack
6+
name: fmt
77
on:
88
push:
99
branches: ["develop"]
1010
jobs:
11-
build:
11+
format:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v1
15-
- name: Set up Python 3.7
16-
uses: actions/setup-python@v1
14+
- uses: actions/checkout@v4
15+
- name: Set up Python 3.10
16+
uses: actions/setup-python@v5
1717
with:
18-
python-version: 3.9
19-
- name: Install Black
20-
run: pip install black
21-
- name: Run black --check .
22-
run: black --check .
23-
- name: If needed, commit black changes to the pull request
18+
python-version: 3.10.14
19+
- name: Install Black & isort
20+
run: pip install black isort
21+
- name: Run black check
22+
run: black --check . --line-length 101
23+
- name: Run isort check
24+
run: isort . --check-only --diff --profile black
25+
- name: If needed, commit changes to the pull request
2426
if: failure()
2527
run: |
2628
black . --line-length 101
29+
isort . --profile black
2730
git config --global user.name github-actions
2831
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
2932
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
3033
git checkout $GITHUB_HEAD_REF
3134
git commit -am "fixup: Format Python code with Black"
3235
git push origin HEAD:develop
36+
37+

.github/workflows/lint.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v4
1010
- uses: psf/black@stable
1111
with:
1212
options: "--line-length 101"
13+
- uses: isort/isort-action@v1
14+
with:
15+
configuration: "--check-only --diff --profile black"

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ fabric.properties
231231
# Android studio 3.1+ serialized cache file
232232
.idea/caches/build_file_checksums.ser
233233

234-
assets/
234+
assets/temp
235+
assets/backgrounds
235236
/.vscode
236237
out
237238
.DS_Store
@@ -244,4 +245,4 @@ video_creation/data/videos.json
244245
video_creation/data/envvars.txt
245246

246247
config.toml
247-
*.exe
248+
*.exe

Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10.9-slim
1+
FROM python:3.10.14-slim
22

33
RUN apt update
44
RUN apt-get install -y ffmpeg
@@ -9,8 +9,4 @@ ADD . /app
99
WORKDIR /app
1010
RUN pip install -r requirements.txt
1111

12-
# tricks for pytube : https://github.com/elebumm/RedditVideoMakerBot/issues/142
13-
# (NOTE : This is no longer useful since pytube was removed from the dependencies)
14-
# RUN sed -i 's/re.compile(r"^\\w+\\W")/re.compile(r"^\\$*\\w+\\W")/' /usr/local/lib/python3.8/dist-packages/pytube/cipher.py
15-
1612
CMD ["python3", "main.py"]

GUI/settings.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
<select name="background_choice" class="form-select" data-toggle="tooltip"
206206
data-original-title='Sets the background of the video'>
207207
<option value=" ">Random Video</option>
208-
{% for background in checks["background_choice"]["options"][1:] %}
208+
{% for background in checks["background_video"]["options"][1:] %}
209209
<option value="{{background}}">{{background}}</option>
210210
{% endfor %}
211211
</select>
@@ -618,4 +618,4 @@
618618
});
619619
</script>
620620

621-
{% endblock %}
621+
{% endblock %}

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ On macOS and Linux (debian, arch, fedora and centos, and based on those), you ca
5050
This can also be used to update the installation
5151

5252
4. Run `python main.py`
53-
5. Visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps), and set up an app that is a "script". Paste any URL in redirect URL. Ex:google.com
53+
5. Visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps), and set up an app that is a "script". Paste any URL in redirect URL. Ex:`https://jasoncameron.dev`
5454
6. The bot will ask you to fill in your details to connect to the Reddit API, and configure the bot to your liking
5555
7. Enjoy 😎
5656
8. If you need to reconfigure the bot, simply open the `config.toml` file and delete the lines that need to be changed. On the next run of the bot, it will help you reconfigure those options.
@@ -81,7 +81,7 @@ I have tried to simplify the code so anyone can read it and start contributing a
8181

8282
Please read our [contributing guidelines](CONTRIBUTING.md) for more detailed information.
8383

84-
### For any questions or support join the [Discord](https://discord.gg/WBQT52RrHV) server
84+
### For any questions or support join the [Discord](https://discord.gg/qfQSx45xCV) server
8585

8686
## Developers and maintainers.
8787

@@ -101,6 +101,8 @@ Freebiell (Freebie#3263) - https://github.com/FreebieII
101101

102102
Aman Raza (electro199#8130) - https://github.com/electro199
103103

104+
Cyteon (cyteon) - https://github.com/cyteon
105+
104106

105107
## LICENSE
106108
[Roboto Fonts](https://fonts.google.com/specimen/Roboto/about) are licensed under [Apache License V2](https://www.apache.org/licenses/LICENSE-2.0)

TTS/TikTok.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import base64
33
import random
44
import time
5-
from typing import Optional, Final
5+
from typing import Final, Optional
66

77
import requests
88

TTS/elevenlabs.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,38 @@
11
import random
22

3-
from elevenlabs import generate, save
3+
from elevenlabs import save
4+
from elevenlabs.client import ElevenLabs
45

56
from utils import settings
67

7-
voices = [
8-
"Adam",
9-
"Antoni",
10-
"Arnold",
11-
"Bella",
12-
"Domi",
13-
"Elli",
14-
"Josh",
15-
"Rachel",
16-
"Sam",
17-
]
18-
198

209
class elevenlabs:
2110
def __init__(self):
2211
self.max_chars = 2500
23-
self.voices = voices
12+
self.client: ElevenLabs = None
2413

2514
def run(self, text, filepath, random_voice: bool = False):
15+
if self.client is None:
16+
self.initialize()
2617
if random_voice:
2718
voice = self.randomvoice()
2819
else:
2920
voice = str(settings.config["settings"]["tts"]["elevenlabs_voice_name"]).capitalize()
3021

22+
audio = self.client.generate(text=text, voice=voice, model="eleven_multilingual_v1")
23+
save(audio=audio, filename=filepath)
24+
25+
def initialize(self):
3126
if settings.config["settings"]["tts"]["elevenlabs_api_key"]:
3227
api_key = settings.config["settings"]["tts"]["elevenlabs_api_key"]
3328
else:
3429
raise ValueError(
3530
"You didn't set an Elevenlabs API key! Please set the config variable ELEVENLABS_API_KEY to a valid API key."
3631
)
3732

38-
audio = generate(api_key=api_key, text=text, voice=voice, model="eleven_multilingual_v1")
39-
save(audio=audio, filename=filepath)
33+
self.client = ElevenLabs(api_key=api_key)
4034

4135
def randomvoice(self):
42-
return random.choice(self.voices)
36+
if self.client is None:
37+
self.initialize()
38+
return random.choice(self.client.voices.get_all().voices).voice_name

TTS/engine_wrapper.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@
1414
from utils.console import print_step, print_substep
1515
from utils.voice import sanitize_text
1616

17-
1817
DEFAULT_MAX_LENGTH: int = (
1918
50 # Video length variable, edit this on your own risk. It should work, but it's not supported
2019
)
2120

2221

2322
class TTSEngine:
24-
2523
"""Calls the given TTS engine to reduce code duplication and allow multiple TTS engines.
2624
2725
Args:

0 commit comments

Comments
 (0)