From c03bd2ae82f9b19b8f9bfd039b06dedbac657c7b Mon Sep 17 00:00:00 2001 From: Arjun Dureja Date: Wed, 1 Jun 2022 13:42:22 -0400 Subject: [PATCH 01/77] Add male voice --- .env.template | 3 ++- main.py | 5 ++++- video_creation/voices.py | 29 ++++++++++++++++++++++++----- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.env.template b/.env.template index e00c242..baf9d46 100644 --- a/.env.template +++ b/.env.template @@ -1,4 +1,5 @@ REDDIT_CLIENT_ID="" REDDIT_CLIENT_SECRET="" REDDIT_USERNAME="" -REDDIT_PASSWORD="" \ No newline at end of file +REDDIT_PASSWORD="" +VOICE="female" \ No newline at end of file diff --git a/main.py b/main.py index 8fb3d50..a394dc0 100644 --- a/main.py +++ b/main.py @@ -5,6 +5,8 @@ from video_creation.background import download_background, chop_background_video from video_creation.voices import save_text_to_mp3 from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts from video_creation.final_video import make_final_video +from dotenv import load_dotenv +import os print_markdown( "### Thanks for using this tool! 😊 [Feel free to contribute to this project on GitHub!](https://lewismenelaws.com). If you have any questions, feel free to reach out to me on Twitter or submit a GitHub issue." @@ -15,7 +17,8 @@ time.sleep(3) reddit_object = get_askreddit_threads() -length, number_of_comments = save_text_to_mp3(reddit_object) +load_dotenv() +length, number_of_comments = save_text_to_mp3(reddit_object, os.getenv("VOICE")) download_screenshots_of_reddit_posts(reddit_object, number_of_comments) download_background() chop_background_video(length) diff --git a/video_creation/voices.py b/video_creation/voices.py index d719ff9..4000245 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -3,9 +3,10 @@ from pathlib import Path from mutagen.mp3 import MP3 from utils.console import print_step, print_substep from rich.progress import track +import requests -def save_text_to_mp3(reddit_obj): +def save_text_to_mp3(reddit_obj, voice): """Saves Text to MP3 files. Args: @@ -17,16 +18,34 @@ def save_text_to_mp3(reddit_obj): # Create a folder for the mp3 files. Path("assets/mp3").mkdir(parents=True, exist_ok=True) - tts = gTTS(text=reddit_obj["thread_title"], lang="en", slow=False, tld="co.uk") - tts.save(f"assets/mp3/title.mp3") + if voice == "female": + tts = gTTS(text=reddit_obj["thread_title"], lang="en", slow=False, tld="co.uk") + tts.save(f"assets/mp3/title.mp3") + elif voice == "male": + url = 'https://streamlabs.com/polly/speak' + body = {'voice': 'Brian', 'text': reddit_obj["thread_title"]} + response = requests.post(url, data = body) + voice_data = requests.get(response.json()['speak_url']) + f = open('assets/mp3/title.mp3', 'wb') + f.write(voice_data.content) + length += MP3(f"assets/mp3/title.mp3").info.length for idx, comment in track(enumerate(reddit_obj["comments"]), "Saving..."): # ! Stop creating mp3 files if the length is greater than 50 seconds. This can be longer, but this is just a good starting point if length > 50: break - tts = gTTS(text=comment["comment_body"], lang="en") - tts.save(f"assets/mp3/{idx}.mp3") + + if voice == "female": + tts = gTTS(text=comment["comment_body"], lang="en") + tts.save(f"assets/mp3/{idx}.mp3") + elif voice == "male": + body = {'voice': 'Brian', 'text': comment["comment_body"]} + response = requests.post(url, data = body) + voice_data = requests.get(response.json()['speak_url']) + f = open(f"assets/mp3/{idx}.mp3", 'wb') + f.write(voice_data.content) + length += MP3(f"assets/mp3/{idx}.mp3").info.length print_substep("Saved Text to MP3 files Successfully.", style="bold green") From f4b7ff736f60ba50c79fe8c2618ffc5dc5581933 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Wed, 1 Jun 2022 19:46:51 -0400 Subject: [PATCH 02/77] .gitignore: Add pycaches --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index a4589e5..3b9b9a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ assets/ +reddit/__pycache__/ +utils/__pycache__/ .env reddit-bot-351418-5560ebc49cac.json \ No newline at end of file From 39a691887eaec73c4fb41214ed906a37f7db5eb1 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Wed, 1 Jun 2022 20:44:54 -0400 Subject: [PATCH 03/77] Create setup TUI and improve overall UX --- main.py | 48 ++++++++++++++++++++++- reddit/askreddit.py | 7 +++- requirements.txt | 2 +- setup.py | 96 +++++++++++++++++++++++++++++++++++++++++++++ utils/loader.py | 53 +++++++++++++++++++++++++ 5 files changed, 202 insertions(+), 4 deletions(-) create mode 100644 setup.py create mode 100644 utils/loader.py diff --git a/main.py b/main.py index 8fb3d50..7e16291 100644 --- a/main.py +++ b/main.py @@ -1,15 +1,61 @@ +# Main from utils.console import print_markdown +from utils.console import print_step +from utils.console import print_substep +from rich.console import Console import time +import os from reddit.askreddit import get_askreddit_threads from video_creation.background import download_background, chop_background_video from video_creation.voices import save_text_to_mp3 from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts from video_creation.final_video import make_final_video - +from utils.loader import Loader +from dotenv import load_dotenv +console = Console() print_markdown( "### Thanks for using this tool! 😊 [Feel free to contribute to this project on GitHub!](https://lewismenelaws.com). If you have any questions, feel free to reach out to me on Twitter or submit a GitHub issue." ) +""" + +Load .env file if exists. If it doesnt exist, print a warning and launch the setup wizard. +If there is a .env file, check if the required variables are set. If not, print a warning and launch the setup wizard. + +""" + +client_id=os.getenv("REDDIT_CLIENT_ID") +client_secret=os.getenv("REDDIT_CLIENT_SECRET") +username=os.getenv("REDDIT_USERNAME") +password=os.getenv("REDDIT_PASSWORD") + +console.log("[bold green]Checking environment variables...") +time.sleep(1) + +if client_id == "" or client_secret == "" or username == "" or password == "": + + console.log("[red]Looks like you need to set your Reddit credentials in the .env file. Please follow the instructions in the README.md file to set them up.") + time.sleep(0.5) + console.log("[red]We can also launch the easy setup wizard. type yes to launch it, or no to quit the program.") + setup_ask = input("Launch setup wizard? > ") + if setup_ask=="yes": + console.log("[bold green]Here goes nothing! Launching setup wizard...") + time.sleep(0.5) + os.system("python3 setup.py") + else: + if setup_ask=="no": + console.print("[red]Exiting...") + time.sleep(0.5) + exit() + else: + console.print("[red]I don't understand that. Exiting...") + time.sleep(0.5) + exit() + + + exit() + +console.log("[bold green]Enviroment Variables are set! Continuing...") time.sleep(3) diff --git a/reddit/askreddit.py b/reddit/askreddit.py index 7c7110a..42afab4 100644 --- a/reddit/askreddit.py +++ b/reddit/askreddit.py @@ -1,9 +1,10 @@ +from rich import Console from utils.console import print_markdown, print_step, print_substep import praw import random from dotenv import load_dotenv import os - +console = Console() def get_askreddit_threads(): """ @@ -14,6 +15,7 @@ def get_askreddit_threads(): content = {} load_dotenv() + console.log("Logging in to reddit...") reddit = praw.Reddit( client_id=os.getenv("REDDIT_CLIENT_ID"), client_secret=os.getenv("REDDIT_CLIENT_SECRET"), @@ -25,6 +27,7 @@ def get_askreddit_threads(): threads = askreddit.hot(limit=25) submission = list(threads)[random.randrange(0, 25)] print_substep(f"Video will be: {submission.title} :thumbsup:") + console.log("Getting video comments...") try: content["thread_url"] = submission.url @@ -43,4 +46,4 @@ def get_askreddit_threads(): except AttributeError as e: pass print_substep("Received AskReddit threads Successfully.", style="bold green") - return content + return content \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index da87ca9..e90970b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,7 +34,7 @@ rich==12.4.4 six==1.16.0 toml==0.10.1 tqdm==4.64.0 -typed-ast==1.4.1 +typed-ast==1.5.4 # Please see issue https://github.com/elebumm/RedditVideoMakerBot/issues/16 comment three. typing_extensions==4.2.0 update-checker==0.18.0 urllib3==1.26.9 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..8214f72 --- /dev/null +++ b/setup.py @@ -0,0 +1,96 @@ +""" + +Setup Script for RedditVideoMakerBot + +""" + +# Imports +import os +import time +from utils.console import print_markdown +from utils.console import print_step +from utils.console import print_substep +from rich.console import Console +from utils.loader import Loader +console = Console() + +# These lines ensure the user: +# - knows they are in setup mode +# - knows that they are about to erase any other setup files/data. + +print_step("Setup Assistant") + +print_markdown( + "### You're in the setup wizard. Ensure you're supposed to be here, then type yes to continue. If you're not sure, type no to quit." +) + +# This Input is used to ensure the user is sure they want to continue. +ensureSetupIsRequired = input("Are you sure you want to continue? > ") +if ensureSetupIsRequired != "yes": + console.print("[red]Exiting...") + time.sleep(0.5) + exit() +else: + # Again, let them know they are about to erase all other setup data. + console.print("[bold red] This will overwrite your current settings. Are you sure you want to continue? [bold green]yes/no") + overwriteSettings = input("Are you sure you want to continue? > ") + if overwriteSettings != "yes": + console.print("[red]Abort mission! Exiting...") + time.sleep(0.5) + exit() + else: + # Once they confirm, move on with the script. + console.print("[bold green]Alright! Let's get started!") + time.sleep(1) + +console.log("Ensure you have the following ready to enter:") +console.log("[bold green]Reddit Client ID") +console.log("[bold green]Reddit Client Secret") +console.log("[bold green]Reddit Username") +console.log("[bold green]Reddit Password") +time.sleep(0.5) +console.print("[green]If you don't have these, please follow the instructions in the README.md file to set them up.") +console.print("[green]If you do have these, type yes to continue. If you dont, go ahead and grab those quickly and come back.") +confirmUserHasCredentials = input("Are you sure you have the credentials? > ") +if confirmUserHasCredentials != "yes": + console.print("[red]I don't understand that.") + console.print("[red]Exiting...") + exit() +else: + console.print("[bold green]Alright! Let's get started!") + time.sleep(1) + +""" + +Begin the setup process. + +""" + +console.log("Enter your credentials now.") +cliID = input("Client ID > ") +cliSec = input("Client Secret > ") +user = input("Username > ") +passw = input("Password > ") +console.log("Attempting to save your credentials...") +loader = Loader("Saving Credentials...", "Done!").start() + # you can also put a while loop here, e.g. while VideoIsBeingMade == True: ... +time.sleep(0.5) +console.log("Removing old .env file...") +os.remove(".env") +time.sleep(0.5) +console.log("Creating new .env file...") +with open('.env', 'a') as f: + f.write(f'REDDIT_CLIENT_ID="{cliID}"\n') + time.sleep(0.5) + f.write(f'REDDIT_CLIENT_SECRET="{cliSec}"\n') + time.sleep(0.5) + f.write(f'REDDIT_USERNAME="{user}"\n') + time.sleep(0.5) + f.write(f'REDDIT_PASSWORD="{passw}"\n') + +loader.stop() + +console.log("[bold green]Setup Complete! Returning...") + +# Post-Setup: send message and try to run main.py again. +os.system("python3 main.py") \ No newline at end of file diff --git a/utils/loader.py b/utils/loader.py new file mode 100644 index 0000000..58fd662 --- /dev/null +++ b/utils/loader.py @@ -0,0 +1,53 @@ +""" + +Okay, have to admit. This code is from StackOverflow. It's so efficient, that it's probably the best way to do it. +Although, it is edited to use less threads. + +""" +from itertools import cycle +from shutil import get_terminal_size +from threading import Thread +from time import sleep + + +class Loader: + def __init__(self, desc="Loading...", end="Done!", timeout=0.1): + """ + A loader-like context manager + + Args: + desc (str, optional): The loader's description. Defaults to "Loading...". + end (str, optional): Final print. Defaults to "Done!". + timeout (float, optional): Sleep time between prints. Defaults to 0.1. + """ + self.desc = desc + self.end = end + self.timeout = timeout + + self._thread = Thread(target=self._animate, daemon=True) + self.steps = ["β’Ώ", "β£»", "β£½", "β£Ύ", "β£·", "β£―", "⣟", "β‘Ώ"] + self.done = False + + def start(self): + self._thread.start() + return self + + def _animate(self): + for c in cycle(self.steps): + if self.done: + break + print(f"\r{self.desc} {c}", flush=True, end="") + sleep(self.timeout) + + def __enter__(self): + self.start() + + def stop(self): + self.done = True + cols = get_terminal_size((80, 20)).columns + print("\r" + " " * cols, end="", flush=True) + print(f"\r{self.end}", flush=True) + + def __exit__(self, exc_type, exc_value, tb): + # handle exceptions with those variables ^ + self.stop() \ No newline at end of file From 74363f021e73a3cad3ee7d0a2f229d2915a27607 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Wed, 1 Jun 2022 20:48:26 -0400 Subject: [PATCH 04/77] README Updates --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 26d8156..3b3acce 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,12 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p ## Installation πŸ‘©β€πŸ’» 1. Clone this repository -2. Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. -3. Run `pip3 install -r requirements.txt` -4. Run `python3 main.py` -5. ... +2. Run `pip3 install -r requirements.txt` +3. + 2a. **Automatic Setup** Run `python3 main.py`, it will automatically detect that you do not have variables set + 2b. **Manual Setup** Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. + +4. (only if you did manual setup) Run `python3 main.py` 6. Enjoy 😎 ## Contributing & Ways to improve πŸ“ˆ From 1e42fd2a3d6ccdfecf620e1c206273149b5f2d26 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Wed, 1 Jun 2022 20:49:23 -0400 Subject: [PATCH 05/77] make readme look better --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3b3acce..708b5ad 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p 1. Clone this repository 2. Run `pip3 install -r requirements.txt` 3. - 2a. **Automatic Setup** Run `python3 main.py`, it will automatically detect that you do not have variables set - 2b. **Manual Setup** Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. + 2a. **Automatic Setup**: Run `python3 main.py`, it will automatically detect that you do not have variables set + 2b. **Manual Setup**: Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. 4. (only if you did manual setup) Run `python3 main.py` 6. Enjoy 😎 From 3c4eac42c097a7c4fe7a54cab6699ae325052fdd Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Wed, 1 Jun 2022 20:49:46 -0400 Subject: [PATCH 06/77] maybe a *little* bit better --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 708b5ad..82d047d 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p 2. Run `pip3 install -r requirements.txt` 3. 2a. **Automatic Setup**: Run `python3 main.py`, it will automatically detect that you do not have variables set + 2b. **Manual Setup**: Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. 4. (only if you did manual setup) Run `python3 main.py` From e4ed7aa69e75538e194d6e75b4cc5e409cd62806 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Wed, 1 Jun 2022 20:51:01 -0400 Subject: [PATCH 07/77] Clarification for setup. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 82d047d..6369b4f 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p 1. Clone this repository 2. Run `pip3 install -r requirements.txt` 3. - 2a. **Automatic Setup**: Run `python3 main.py`, it will automatically detect that you do not have variables set + 2a. **Automatic Setup**: Run `python3 main.py` and type "yes" where it says "Setup Wizard". The Setup Wizard will guide you through the setup process. 2b. **Manual Setup**: Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. From e03f52988837745f3c583d31525fb6f6132f08b4 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Wed, 1 Jun 2022 20:55:20 -0400 Subject: [PATCH 08/77] README: got some of the stages mixed up. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6369b4f..8e7eec7 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,9 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p 1. Clone this repository 2. Run `pip3 install -r requirements.txt` 3. - 2a. **Automatic Setup**: Run `python3 main.py` and type "yes" where it says "Setup Wizard". The Setup Wizard will guide you through the setup process. + 3a. **Automatic Setup**: Run `python3 main.py` and type "yes" where it says "Setup Wizard". The Setup Wizard will guide you through the setup process. - 2b. **Manual Setup**: Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. + 3b. **Manual Setup**: Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. 4. (only if you did manual setup) Run `python3 main.py` 6. Enjoy 😎 From 21c8da3648cb1024448f35cd6b6f51b6370d82f2 Mon Sep 17 00:00:00 2001 From: Kamushy <92086533+Kamushy@users.noreply.github.com> Date: Thu, 2 Jun 2022 21:57:32 +1000 Subject: [PATCH 09/77] Made submission global --- reddit/askreddit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reddit/askreddit.py b/reddit/askreddit.py index 7c7110a..21b2277 100644 --- a/reddit/askreddit.py +++ b/reddit/askreddit.py @@ -4,8 +4,8 @@ import random from dotenv import load_dotenv import os - def get_askreddit_threads(): + global submission """ Returns a list of threads from the AskReddit subreddit. """ From 9bb1aa351e222d10308ab16baacaea43575278b7 Mon Sep 17 00:00:00 2001 From: Kamushy <92086533+Kamushy@users.noreply.github.com> Date: Thu, 2 Jun 2022 22:00:24 +1000 Subject: [PATCH 10/77] made name change correctly line 59 is if any of characters cant be turned into a file remove them --- video_creation/final_video.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 947ab04..25f80f0 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -7,6 +7,8 @@ from moviepy.editor import ( CompositeAudioClip, CompositeVideoClip, ) +import reddit.askreddit +import re from utils.console import print_step @@ -14,6 +16,7 @@ W, H = 1080, 1920 def make_final_video(number_of_clips): + global submission print_step("Creating the final video πŸŽ₯") VideoFileClip.reW = lambda clip: clip.resize(width=W) VideoFileClip.reH = lambda clip: clip.resize(width=H) @@ -53,9 +56,7 @@ def make_final_video(number_of_clips): ) image_concat.audio = audio_composite final = CompositeVideoClip([background_clip, image_concat]) - final.write_videofile( - "assets/final_video.mp4", fps=30, audio_codec="aac", audio_bitrate="192k" - ) - + filename = (re.sub('[?\"/%*:|<>]', '', ("assets/" + reddit.askreddit.submission.title + ".mp4"))) + final.write_videofile(filename, fps=30, audio_codec="aac", audio_bitrate="192k") for i in range(0, number_of_clips): pass From 93bcd7be772d565be7e893f336fe5a4e3cce107d Mon Sep 17 00:00:00 2001 From: Kamushy <92086533+Kamushy@users.noreply.github.com> Date: Thu, 2 Jun 2022 22:57:02 +1000 Subject: [PATCH 11/77] file will now go to correct folder --- video_creation/final_video.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 25f80f0..f711568 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -56,7 +56,7 @@ def make_final_video(number_of_clips): ) image_concat.audio = audio_composite final = CompositeVideoClip([background_clip, image_concat]) - filename = (re.sub('[?\"/%*:|<>]', '', ("assets/" + reddit.askreddit.submission.title + ".mp4"))) + filename = (re.sub('[?\"%*:|<>]', '', ("assets/" + reddit.askreddit.submission.title + ".mp4"))) final.write_videofile(filename, fps=30, audio_codec="aac", audio_bitrate="192k") for i in range(0, number_of_clips): pass From 16664e010a8d57a89acef3ad576143e8580c8330 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Thu, 2 Jun 2022 13:11:10 -0400 Subject: [PATCH 12/77] Reviews: Various Changes --- main.py | 2 +- setup.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 7e16291..2c026ae 100644 --- a/main.py +++ b/main.py @@ -32,7 +32,7 @@ password=os.getenv("REDDIT_PASSWORD") console.log("[bold green]Checking environment variables...") time.sleep(1) -if client_id == "" or client_secret == "" or username == "" or password == "": +if not all(client_id, client_secret, username, password): console.log("[red]Looks like you need to set your Reddit credentials in the .env file. Please follow the instructions in the README.md file to set them up.") time.sleep(0.5) diff --git a/setup.py b/setup.py index 8214f72..7e4521f 100644 --- a/setup.py +++ b/setup.py @@ -12,8 +12,15 @@ from utils.console import print_step from utils.console import print_substep from rich.console import Console from utils.loader import Loader +from os.path import exists console = Console() +setup_done = exists(".setup-done-before") + +if setup_done == True: + console.log("[red]Setup was already completed! Please make sure you have to run this script again. If you have to, please delete the file .setup-done-before") + exit() + # These lines ensure the user: # - knows they are in setup mode # - knows that they are about to erase any other setup files/data. @@ -25,7 +32,7 @@ print_markdown( ) # This Input is used to ensure the user is sure they want to continue. -ensureSetupIsRequired = input("Are you sure you want to continue? > ") +ensureSetupIsRequired = input("Are you sure you want to continue? > ").casefold() if ensureSetupIsRequired != "yes": console.print("[red]Exiting...") time.sleep(0.5) @@ -33,7 +40,7 @@ if ensureSetupIsRequired != "yes": else: # Again, let them know they are about to erase all other setup data. console.print("[bold red] This will overwrite your current settings. Are you sure you want to continue? [bold green]yes/no") - overwriteSettings = input("Are you sure you want to continue? > ") + overwriteSettings = input("Are you sure you want to continue? > ").casefold() if overwriteSettings != "yes": console.print("[red]Abort mission! Exiting...") time.sleep(0.5) @@ -51,7 +58,7 @@ console.log("[bold green]Reddit Password") time.sleep(0.5) console.print("[green]If you don't have these, please follow the instructions in the README.md file to set them up.") console.print("[green]If you do have these, type yes to continue. If you dont, go ahead and grab those quickly and come back.") -confirmUserHasCredentials = input("Are you sure you have the credentials? > ") +confirmUserHasCredentials = input("Are you sure you have the credentials? > ").casefold() if confirmUserHasCredentials != "yes": console.print("[red]I don't understand that.") console.print("[red]Exiting...") @@ -88,6 +95,9 @@ with open('.env', 'a') as f: time.sleep(0.5) f.write(f'REDDIT_PASSWORD="{passw}"\n') +with open('.setup-done-before', 'a') as f: + f.write("This file blocks the setup assistant from running again. Delete this file to run setup again.") + loader.stop() console.log("[bold green]Setup Complete! Returning...") From 593094d14b075eec523382154a84f25c043237e1 Mon Sep 17 00:00:00 2001 From: andronedev Date: Thu, 2 Jun 2022 21:49:38 +0200 Subject: [PATCH 13/77] add Docker support --- .dockerignore | 1 + .gitignore | 4 +++- Dockerfile | 14 ++++++++++++++ build.sh | 1 + run.sh | 1 + video_creation/screenshot_downloader.py | 7 ++++--- 6 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 build.sh create mode 100755 run.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1d1fe94 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Dockerfile \ No newline at end of file diff --git a/.gitignore b/.gitignore index a4589e5..52b1988 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ assets/ .env -reddit-bot-351418-5560ebc49cac.json \ No newline at end of file +reddit-bot-351418-5560ebc49cac.json +__pycache__ +out \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9d7f280 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM mcr.microsoft.com/playwright + +RUN apt update +RUN apt install python3-pip -y + +RUN mkdir /app +ADD . /app +WORKDIR /app +RUN pip install -r requirements.txt + +# tricks for pytube : https://github.com/elebumm/RedditVideoMakerBot/issues/142 +RUN sed -i 's/re.compile(r"^\\w+\\W")/re.compile(r"^\\$*\\w+\\W")/' /usr/local/lib/python3.8/dist-packages/pytube/cipher.py + +CMD ["python3", "main.py"] \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..7d4dfc6 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +docker build -t rvmt . \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..f2a150f --- /dev/null +++ b/run.sh @@ -0,0 +1 @@ +docker run -v $(pwd)/out/:/app/assets -it rvmt \ No newline at end of file diff --git a/video_creation/screenshot_downloader.py b/video_creation/screenshot_downloader.py index 66c96f1..e5a5dbf 100644 --- a/video_creation/screenshot_downloader.py +++ b/video_creation/screenshot_downloader.py @@ -1,4 +1,4 @@ -from playwright.sync_api import sync_playwright +from playwright.sync_api import sync_playwright, ViewportSize from pathlib import Path from rich.progress import track from utils.console import print_step, print_substep @@ -24,7 +24,7 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num): # Get the thread screenshot page = browser.new_page() page.goto(reddit_object["thread_url"]) - + page.set_viewport_size(ViewportSize(width=1920, height=1080)) if page.locator('[data-testid="content-gate"]').is_visible(): # This means the post is NSFW and requires to click the proceed button. @@ -50,4 +50,5 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num): page.locator(f"#t1_{comment['comment_id']}").screenshot( path=f"assets/png/comment_{idx}.png" ) - print_substep("Screenshots downloaded Successfully.", style="bold green") + print_substep("Screenshots downloaded Successfully.", + style="bold green") From 52302cc42d7e399ccfaf47c94f37381f32fadfb9 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Thu, 2 Jun 2022 16:09:47 -0400 Subject: [PATCH 14/77] gitignore - new files --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3b9b9a4..d6b5611 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ assets/ reddit/__pycache__/ utils/__pycache__/ .env -reddit-bot-351418-5560ebc49cac.json \ No newline at end of file +reddit-bot-351418-5560ebc49cac.json +video_creation/__pycache__/ +.setup-done-before \ No newline at end of file From 49de46dd539c1d75f77691fa348b0c85cf66862c Mon Sep 17 00:00:00 2001 From: andronedev <31452517+andronedev@users.noreply.github.com> Date: Thu, 2 Jun 2022 22:14:17 +0200 Subject: [PATCH 15/77] Update Dockerfile --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d7f280..1f68ea0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ WORKDIR /app RUN pip install -r requirements.txt # tricks for pytube : https://github.com/elebumm/RedditVideoMakerBot/issues/142 -RUN sed -i 's/re.compile(r"^\\w+\\W")/re.compile(r"^\\$*\\w+\\W")/' /usr/local/lib/python3.8/dist-packages/pytube/cipher.py +# (NOTE : This is no longer useful since pytube was removed from the dependencies) +# RUN sed -i 's/re.compile(r"^\\w+\\W")/re.compile(r"^\\$*\\w+\\W")/' /usr/local/lib/python3.8/dist-packages/pytube/cipher.py -CMD ["python3", "main.py"] \ No newline at end of file +CMD ["python3", "main.py"] From 4506339e21f673e911f8f5badaee4d20d53c1c07 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Thu, 2 Jun 2022 16:16:15 -0400 Subject: [PATCH 16/77] ACCEPT: Incoming Change (main.py) --- main.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/main.py b/main.py index f1782b2..498d78f 100644 --- a/main.py +++ b/main.py @@ -4,15 +4,8 @@ from utils.console import print_step from utils.console import print_substep from rich.console import Console import time -<<<<<<< HEAD import os -from reddit.askreddit import get_askreddit_threads -||||||| 5b39896 -from reddit.askreddit import get_askreddit_threads -======= - from reddit.subreddit import get_subreddit_threads ->>>>>>> 6fc5d2a7377dfe9f65d0d011fc260602527847c9 from video_creation.background import download_background, chop_background_video from video_creation.voices import save_text_to_mp3 from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts From d8def59e5d583071c47eb89cbf86241574eb2808 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Thu, 2 Jun 2022 16:17:48 -0400 Subject: [PATCH 17/77] ACCEPT: Incoming change. (README.md) --- README.md | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/README.md b/README.md index 05ae2df..1dbec21 100644 --- a/README.md +++ b/README.md @@ -31,29 +31,12 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p ## Installation πŸ‘©β€πŸ’» 1. Clone this repository -<<<<<<< HEAD -2. Run `pip3 install -r requirements.txt` -3. - 3a. **Automatic Setup**: Run `python3 main.py` and type "yes" where it says "Setup Wizard". The Setup Wizard will guide you through the setup process. - - 3b. **Manual Setup**: Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. - -4. (only if you did manual setup) Run `python3 main.py` -6. Enjoy 😎 -||||||| 5b39896 -2. Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` files. -3. Run `pip3 install -r requirements.txt` -4. Run `python3 main.py` -5. ... -6. Enjoy 😎 -======= 2. Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` file, along with whether your account uses two-factor authentication. 3. Run `pip3 install -r requirements.txt` 4. Run `playwright install` and `playwright install-deps`. 5. Run `python3 main.py` 6. ... 7. Enjoy 😎 ->>>>>>> 6fc5d2a7377dfe9f65d0d011fc260602527847c9 ## Contributing & Ways to improve πŸ“ˆ @@ -65,4 +48,4 @@ I have tried to simplify the code so anyone can read it and start contributing a - [ ] Allowing users to choose a background that is picked instead of the Minecraft one. - [x] Allowing users to choose between any subreddit. - [ ] Allowing users to change voice. -- [ ] Creating better documentation and adding a command line interface. +- [ ] Creating better documentation and adding a command line interface. \ No newline at end of file From b1c98726eb8389553c78882717877b7cc28251ed Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Thu, 2 Jun 2022 16:20:35 -0400 Subject: [PATCH 18/77] README: Automatic install --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1dbec21..630cca4 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,14 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p ## Installation πŸ‘©β€πŸ’» 1. Clone this repository -2. Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` file, along with whether your account uses two-factor authentication. -3. Run `pip3 install -r requirements.txt` -4. Run `playwright install` and `playwright install-deps`. -5. Run `python3 main.py` +2. Run `pip3 install -r requirements.txt` +3. Run `playwright install` and `playwright install-deps`. +4. + 4a **Automatic Install**: Run `python3 main.py` and type 'yes' to activate the setup assistant. + + 4b **Manual Install**: Rename `.env.template` to `.env` and replace all values with the appropriate fields. To get Reddit keys (**required**), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". Copy your keys into the `.env` file, along with whether your account uses two-factor authentication. + +5. Run `python3 main.py` (unless you chose automatic install, then the installer will automatically run main.py) 6. ... 7. Enjoy 😎 From 3b26c0e282fd3e9cbd344fb154d6c5034c0310fa Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Thu, 2 Jun 2022 16:22:07 -0400 Subject: [PATCH 19/77] main.py: Add REDDIT_2FA to env variable check. --- main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main.py b/main.py index 498d78f..07f2f13 100644 --- a/main.py +++ b/main.py @@ -28,6 +28,8 @@ client_id=os.getenv("REDDIT_CLIENT_ID") client_secret=os.getenv("REDDIT_CLIENT_SECRET") username=os.getenv("REDDIT_USERNAME") password=os.getenv("REDDIT_PASSWORD") +reddit2fa=os.getenv("REDDIT_2FA") + console.log("[bold green]Checking environment variables...") time.sleep(1) From e18bb1229ac19f166389c67cbc6e4ef361b9e058 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Thu, 2 Jun 2022 16:23:09 -0400 Subject: [PATCH 20/77] REQUIREMENTS.TXT: Accept Incoming Change --- requirements.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 6ae7cfe..59dc596 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,13 +35,7 @@ rich==12.4.4 six==1.16.0 toml==0.10.1 tqdm==4.64.0 -<<<<<<< HEAD -typed-ast==1.5.4 # Please see issue https://github.com/elebumm/RedditVideoMakerBot/issues/16 comment three. -||||||| 5b39896 -typed-ast==1.4.1 -======= typed-ast==1.5.4 ->>>>>>> 6fc5d2a7377dfe9f65d0d011fc260602527847c9 typing_extensions==4.2.0 update-checker==0.18.0 urllib3==1.26.9 From 51d561bc3e479bd6cb5b5791411a6459b028d4d2 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Thu, 2 Jun 2022 16:25:39 -0400 Subject: [PATCH 21/77] Removed an extra line in main.py; added 2fa to setup.py --- main.py | 2 +- setup.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 07f2f13..1882039 100644 --- a/main.py +++ b/main.py @@ -67,4 +67,4 @@ length, number_of_comments = save_text_to_mp3(reddit_object) download_screenshots_of_reddit_posts(reddit_object, number_of_comments) download_background() chop_background_video(length) -final_video = make_final_video(number_of_comments) +final_video = make_final_video(number_of_comments) \ No newline at end of file diff --git a/setup.py b/setup.py index 7e4521f..f49b03b 100644 --- a/setup.py +++ b/setup.py @@ -55,6 +55,7 @@ console.log("[bold green]Reddit Client ID") console.log("[bold green]Reddit Client Secret") console.log("[bold green]Reddit Username") console.log("[bold green]Reddit Password") +console.log("[bold green]Reddit 2FA (yes or no)") time.sleep(0.5) console.print("[green]If you don't have these, please follow the instructions in the README.md file to set them up.") console.print("[green]If you do have these, type yes to continue. If you dont, go ahead and grab those quickly and come back.") @@ -78,6 +79,7 @@ cliID = input("Client ID > ") cliSec = input("Client Secret > ") user = input("Username > ") passw = input("Password > ") +twofactor = input("2fa Enabled? (yes/no) > ") console.log("Attempting to save your credentials...") loader = Loader("Saving Credentials...", "Done!").start() # you can also put a while loop here, e.g. while VideoIsBeingMade == True: ... @@ -94,6 +96,8 @@ with open('.env', 'a') as f: f.write(f'REDDIT_USERNAME="{user}"\n') time.sleep(0.5) f.write(f'REDDIT_PASSWORD="{passw}"\n') + time.sleep(0.5) + f.write(f'REDDIT_2FA="{twofactor}"\n') with open('.setup-done-before', 'a') as f: f.write("This file blocks the setup assistant from running again. Delete this file to run setup again.") From 6b8b96665cb411a0ba89d964e05c411ff8eed48b Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Thu, 2 Jun 2022 16:26:32 -0400 Subject: [PATCH 22/77] Accept Incoming Change --- reddit/subreddit.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index ce4e342..e4a6e69 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -28,14 +28,6 @@ def get_subreddit_threads(): passkey = os.getenv("REDDIT_PASSWORD") content = {} -<<<<<<< HEAD:reddit/askreddit.py - load_dotenv() - console.log("Logging in to reddit...") -||||||| 5b39896:reddit/askreddit.py - load_dotenv() -======= - ->>>>>>> 6fc5d2a7377dfe9f65d0d011fc260602527847c9:reddit/subreddit.py reddit = praw.Reddit( client_id=os.getenv("REDDIT_CLIENT_ID"), client_secret=os.getenv("REDDIT_CLIENT_SECRET"), @@ -77,14 +69,6 @@ def get_subreddit_threads(): except AttributeError as e: pass -<<<<<<< HEAD:reddit/askreddit.py - print_substep("Received AskReddit threads Successfully.", style="bold green") - return content -||||||| 5b39896:reddit/askreddit.py - print_substep("Received AskReddit threads Successfully.", style="bold green") - return content -======= print_substep("Received AskReddit threads successfully.", style="bold green") return content ->>>>>>> 6fc5d2a7377dfe9f65d0d011fc260602527847c9:reddit/subreddit.py From 030c7706c69905952fbc0e382a312c35e2c85f41 Mon Sep 17 00:00:00 2001 From: andronedev Date: Thu, 2 Jun 2022 22:56:32 +0200 Subject: [PATCH 23/77] =?UTF-8?q?=E2=9C=A8feature:=20possibility=20to=20us?= =?UTF-8?q?e=20an=20external=20.env=20instead=20of=20having=20to=20build?= =?UTF-8?q?=20the=20container=20for=20each=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.sh b/run.sh index f2a150f..4dcb69a 100755 --- a/run.sh +++ b/run.sh @@ -1 +1 @@ -docker run -v $(pwd)/out/:/app/assets -it rvmt \ No newline at end of file +docker run -v $(pwd)/out/:/app/assets -v $(pwd)/.env:/app/.env -it rvmt \ No newline at end of file From bed5dd2ab2737735ff24fb9b9523382c2429e40b Mon Sep 17 00:00:00 2001 From: Kamushy <92086533+Kamushy@users.noreply.github.com> Date: Fri, 3 Jun 2022 09:18:05 +1000 Subject: [PATCH 24/77] Made ENV make more sense A couple were submitting links into the subreddit field --- .env.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.template b/.env.template index f00c2ac..033c9d9 100644 --- a/.env.template +++ b/.env.template @@ -6,5 +6,5 @@ REDDIT_PASSWORD="" # Valid options are "yes" and "no" for the variable below REDDIT_2FA="" - +# Enter a subreddit, e.g. "AskReddit" or "r/AskReddit" SUBREDDIT="" From 757768be151e250390e4ff78dcfa82897f5fe6be Mon Sep 17 00:00:00 2001 From: Kamushy <92086533+Kamushy@users.noreply.github.com> Date: Fri, 3 Jun 2022 11:50:54 +1000 Subject: [PATCH 25/77] Making it work with newer code version --- reddit/askreddit.py | 1 - 1 file changed, 1 deletion(-) diff --git a/reddit/askreddit.py b/reddit/askreddit.py index 21b2277..78ec481 100644 --- a/reddit/askreddit.py +++ b/reddit/askreddit.py @@ -5,7 +5,6 @@ from dotenv import load_dotenv import os def get_askreddit_threads(): - global submission """ Returns a list of threads from the AskReddit subreddit. """ From 8546deac7d93cdda847e5941523320161533d645 Mon Sep 17 00:00:00 2001 From: Kamushy Date: Fri, 3 Jun 2022 11:59:36 +1000 Subject: [PATCH 26/77] Added it back Have no idea how do this --- reddit/askreddit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/reddit/askreddit.py b/reddit/askreddit.py index 78ec481..21b2277 100644 --- a/reddit/askreddit.py +++ b/reddit/askreddit.py @@ -5,6 +5,7 @@ from dotenv import load_dotenv import os def get_askreddit_threads(): + global submission """ Returns a list of threads from the AskReddit subreddit. """ From c4f32a3821317ae039dadd0043b265a2619cf49e Mon Sep 17 00:00:00 2001 From: MeDBeD1 <82283979+MeDBeD1@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:48:20 +1000 Subject: [PATCH 27/77] TTS reads text below the tittle of the post Added option for TTS to read the whole post if text apart from tittle is present (useful for such threads as r/maliciouscompliance) --- subreddit.py | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 subreddit.py diff --git a/subreddit.py b/subreddit.py new file mode 100644 index 0000000..e9ae4fe --- /dev/null +++ b/subreddit.py @@ -0,0 +1,73 @@ +from utils.console import print_markdown, print_step, print_substep +import praw +import random +from dotenv import load_dotenv +import os + + +def get_subreddit_threads(): + + """ + Returns a list of threads from the AskReddit subreddit. + """ + + load_dotenv() + + print_step("Getting AskReddit threads...") + + if os.getenv("REDDIT_2FA").lower() == "yes": + print( + "\nEnter your two-factor authentication code from your authenticator app.\n" + ) + code = input("> ") + print() + pw = os.getenv("REDDIT_PASSWORD") + passkey = f"{pw}:{code}" + else: + passkey = os.getenv("REDDIT_PASSWORD") + + content = {} + + reddit = praw.Reddit( + client_id=os.getenv("REDDIT_CLIENT_ID"), + client_secret=os.getenv("REDDIT_CLIENT_SECRET"), + user_agent="Accessing AskReddit threads", + username=os.getenv("REDDIT_USERNAME"), + password=passkey, + ) + + if os.getenv("SUBREDDIT"): + subreddit = reddit.subreddit(os.getenv("SUBREDDIT")) + else: + # ! Prompt the user to enter a subreddit + try: + subreddit = reddit.subreddit( + input("What subreddit would you like to pull from? ") + ) + except ValueError: + subreddit = reddit.subreddit("askreddit") + print_substep("Subreddit not defined. Using AskReddit.") + + threads = subreddit.hot(limit=25) + submission = list(threads)[random.randrange(0, 25)] + print_substep(f"Video will be: {submission.title} :thumbsup:") + try: + + content["thread_url"] = submission.url + content["thread_title"] = submission.title + submission.selftext + content["comments"] = [] + + for top_level_comment in submission.comments: + content["comments"].append( + { + "comment_body": top_level_comment.body, + "comment_url": top_level_comment.permalink, + "comment_id": top_level_comment.id, + } + ) + + except AttributeError as e: + pass + print_substep("Received AskReddit threads successfully.", style="bold green") + + return content From 310006a166974580645570b8103f88cec7e25db0 Mon Sep 17 00:00:00 2001 From: MeDBeD1 <82283979+MeDBeD1@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:50:36 +1000 Subject: [PATCH 28/77] Deleting becasue i commited in the wrong way, whoops --- subreddit.py | 73 ---------------------------------------------------- 1 file changed, 73 deletions(-) delete mode 100644 subreddit.py diff --git a/subreddit.py b/subreddit.py deleted file mode 100644 index e9ae4fe..0000000 --- a/subreddit.py +++ /dev/null @@ -1,73 +0,0 @@ -from utils.console import print_markdown, print_step, print_substep -import praw -import random -from dotenv import load_dotenv -import os - - -def get_subreddit_threads(): - - """ - Returns a list of threads from the AskReddit subreddit. - """ - - load_dotenv() - - print_step("Getting AskReddit threads...") - - if os.getenv("REDDIT_2FA").lower() == "yes": - print( - "\nEnter your two-factor authentication code from your authenticator app.\n" - ) - code = input("> ") - print() - pw = os.getenv("REDDIT_PASSWORD") - passkey = f"{pw}:{code}" - else: - passkey = os.getenv("REDDIT_PASSWORD") - - content = {} - - reddit = praw.Reddit( - client_id=os.getenv("REDDIT_CLIENT_ID"), - client_secret=os.getenv("REDDIT_CLIENT_SECRET"), - user_agent="Accessing AskReddit threads", - username=os.getenv("REDDIT_USERNAME"), - password=passkey, - ) - - if os.getenv("SUBREDDIT"): - subreddit = reddit.subreddit(os.getenv("SUBREDDIT")) - else: - # ! Prompt the user to enter a subreddit - try: - subreddit = reddit.subreddit( - input("What subreddit would you like to pull from? ") - ) - except ValueError: - subreddit = reddit.subreddit("askreddit") - print_substep("Subreddit not defined. Using AskReddit.") - - threads = subreddit.hot(limit=25) - submission = list(threads)[random.randrange(0, 25)] - print_substep(f"Video will be: {submission.title} :thumbsup:") - try: - - content["thread_url"] = submission.url - content["thread_title"] = submission.title + submission.selftext - content["comments"] = [] - - for top_level_comment in submission.comments: - content["comments"].append( - { - "comment_body": top_level_comment.body, - "comment_url": top_level_comment.permalink, - "comment_id": top_level_comment.id, - } - ) - - except AttributeError as e: - pass - print_substep("Received AskReddit threads successfully.", style="bold green") - - return content From 89d69ff0af09d5904406ae04096460e106a9a59b Mon Sep 17 00:00:00 2001 From: MeDBeD1 <82283979+MeDBeD1@users.noreply.github.com> Date: Sat, 4 Jun 2022 00:53:14 +1000 Subject: [PATCH 29/77] TTS update to read the text below tittle if there is any --- reddit/subreddit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 5d020fe..e9ae4fe 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -54,7 +54,7 @@ def get_subreddit_threads(): try: content["thread_url"] = submission.url - content["thread_title"] = submission.title + content["thread_title"] = submission.title + submission.selftext content["comments"] = [] for top_level_comment in submission.comments: From 20217be743aad2b7e2d30e608304eb1fc921c9da Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Fri, 3 Jun 2022 13:22:23 -0400 Subject: [PATCH 30/77] resolve gitignore conflict --- .gitignore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitignore b/.gitignore index b85be09..6cf136b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,13 +2,7 @@ assets/ reddit/__pycache__/ utils/__pycache__/ .env -<<<<<<< HEAD reddit-bot-351418-5560ebc49cac.json video_creation/__pycache__/ .setup-done-before -||||||| 5b39896 -reddit-bot-351418-5560ebc49cac.json -======= -reddit-bot-351418-5560ebc49cac.json __pycache__ ->>>>>>> 6fc5d2a7377dfe9f65d0d011fc260602527847c9 From 3f32feaa2466cd1136e6c2a1875654032e6ee14c Mon Sep 17 00:00:00 2001 From: Arjun Dureja Date: Fri, 3 Jun 2022 13:51:43 -0400 Subject: [PATCH 31/77] add character limit for male voice --- main.py | 4 ++-- reddit/askreddit.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index a394dc0..872362c 100644 --- a/main.py +++ b/main.py @@ -15,9 +15,9 @@ print_markdown( time.sleep(3) -reddit_object = get_askreddit_threads() - load_dotenv() +reddit_object = get_askreddit_threads(os.getenv("VOICE")) + length, number_of_comments = save_text_to_mp3(reddit_object, os.getenv("VOICE")) download_screenshots_of_reddit_posts(reddit_object, number_of_comments) download_background() diff --git a/reddit/askreddit.py b/reddit/askreddit.py index 7c7110a..1e3b3b3 100644 --- a/reddit/askreddit.py +++ b/reddit/askreddit.py @@ -5,7 +5,7 @@ from dotenv import load_dotenv import os -def get_askreddit_threads(): +def get_askreddit_threads(voice): """ Returns a list of threads from the AskReddit subreddit. """ @@ -32,6 +32,8 @@ def get_askreddit_threads(): content["comments"] = [] for top_level_comment in submission.comments: + if voice == "male" and len(top_level_comment.body) > 550: + continue content["comments"].append( { "comment_body": top_level_comment.body, From b9b46774ff25ae256291ec7307d333ea9b585ab9 Mon Sep 17 00:00:00 2001 From: Arjun Dureja Date: Fri, 3 Jun 2022 13:57:20 -0400 Subject: [PATCH 32/77] Create function for generating and saving TTS --- video_creation/voices.py | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/video_creation/voices.py b/video_creation/voices.py index 4000245..27e5c6d 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -18,17 +18,7 @@ def save_text_to_mp3(reddit_obj, voice): # Create a folder for the mp3 files. Path("assets/mp3").mkdir(parents=True, exist_ok=True) - if voice == "female": - tts = gTTS(text=reddit_obj["thread_title"], lang="en", slow=False, tld="co.uk") - tts.save(f"assets/mp3/title.mp3") - elif voice == "male": - url = 'https://streamlabs.com/polly/speak' - body = {'voice': 'Brian', 'text': reddit_obj["thread_title"]} - response = requests.post(url, data = body) - voice_data = requests.get(response.json()['speak_url']) - f = open('assets/mp3/title.mp3', 'wb') - f.write(voice_data.content) - + generate_and_save_tts(voice, reddit_obj["thread_title"], "assets/mp3/title.mp3") length += MP3(f"assets/mp3/title.mp3").info.length for idx, comment in track(enumerate(reddit_obj["comments"]), "Saving..."): @@ -36,18 +26,21 @@ def save_text_to_mp3(reddit_obj, voice): if length > 50: break - if voice == "female": - tts = gTTS(text=comment["comment_body"], lang="en") - tts.save(f"assets/mp3/{idx}.mp3") - elif voice == "male": - body = {'voice': 'Brian', 'text': comment["comment_body"]} - response = requests.post(url, data = body) - voice_data = requests.get(response.json()['speak_url']) - f = open(f"assets/mp3/{idx}.mp3", 'wb') - f.write(voice_data.content) - + generate_and_save_tts(voice, comment["comment_body"], f"assets/mp3/{idx}.mp3") length += MP3(f"assets/mp3/{idx}.mp3").info.length print_substep("Saved Text to MP3 files Successfully.", style="bold green") # ! Return the index so we know how many screenshots of comments we need to make. return length, idx + +def generate_and_save_tts(voice, text, file_name): + if voice == "female": + tts = gTTS(text=text, lang="en") + tts.save(file_name) + elif voice == "male": + url = 'https://streamlabs.com/polly/speak' + body = {'voice': 'Brian', 'text': text} + response = requests.post(url, data = body) + voice_data = requests.get(response.json()['speak_url']) + f = open(file_name, 'wb') + f.write(voice_data.content) \ No newline at end of file From d858c1ca5f0365b000e7ddd114ac050d5229de23 Mon Sep 17 00:00:00 2001 From: Domiziano Scarcelli Date: Fri, 3 Jun 2022 23:42:41 +0200 Subject: [PATCH 33/77] Allowing the user to choose a thread by inserting the thread link --- .DS_Store | Bin 0 -> 6148 bytes .env.template | 6 ++- .idea/.gitignore | 3 ++ .idea/RedditVideoMakerBot.iml | 14 +++++++ .../inspectionProfiles/profiles_settings.xml | 6 +++ .idea/misc.xml | 4 ++ .idea/modules.xml | 8 ++++ .idea/vcs.xml | 6 +++ reddit/subreddit.py | 39 +++++++++++------- 9 files changed, 71 insertions(+), 15 deletions(-) create mode 100644 .DS_Store create mode 100644 .idea/.gitignore create mode 100644 .idea/RedditVideoMakerBot.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d9fbee9a2d2bee2e47c875e2dc0b7508612c6686 GIT binary patch literal 6148 zcmeHK%}T>S5Z<-5Nhm@N3OxqA7OX+k;w8lT0!H+pQWFw17_+5G?V%KM))(?gd>&_Z zH-})rn~0q$yWi~m>}Edb{xHV4zlaYRvl(M1G(?U{i=esHwWWg*xtyb9MYJqtQ6{36 ziTU6hzhG7|f<34y2%b*O)Md63@TO3^pkwvv0 zM%QVwoZ7qRA}_-J%3)ciHMIw;m3urII_~Modg!di zF6c*NcfGdEz5Ro;%jt9Wl8ZM*BnQr=>}agv9h62*ufaUeME(f&I;V~$BnF59Vt^Rf zJO=bxVD>k!bgGybAO?P50QUz68ltDMQYg0$=km;3^&Lj*jy*Rti-*<8oz~N3UEzUbtKx?2Zg)+*3$BF+dD78R)2?jpzRb{AF4n z`OOp>5d*})KVyJ*C&9#rqV(DNtvozy9cT~GP%y4S1qAfQB>)Dvj|`+!`5n|D&eK>a V#97cT(*fxsAPJ$482AMSz5umqOj-Z{ literal 0 HcmV?d00001 diff --git a/.env.template b/.env.template index f00c2ac..9e2218f 100644 --- a/.env.template +++ b/.env.template @@ -1,10 +1,14 @@ REDDIT_CLIENT_ID="" REDDIT_CLIENT_SECRET="" + REDDIT_USERNAME="" REDDIT_PASSWORD="" # Valid options are "yes" and "no" for the variable below REDDIT_2FA="" +SUBREDDIT="askReddit" -SUBREDDIT="" +# Link of the thread +# (e.g. https://www.reddit.com/r/memes/comments/sbr31o/discordggrmemes_the_official_rmemes_discord_server/) +THREAD="" \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/RedditVideoMakerBot.iml b/.idea/RedditVideoMakerBot.iml new file mode 100644 index 0000000..8e5446a --- /dev/null +++ b/.idea/RedditVideoMakerBot.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..653ebc1 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1fd5644 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 5d020fe..c2f6547 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -13,7 +13,6 @@ def get_subreddit_threads(): load_dotenv() - print_step("Getting AskReddit threads...") if os.getenv("REDDIT_2FA").lower() == "yes": print( @@ -35,24 +34,36 @@ def get_subreddit_threads(): username=os.getenv("REDDIT_USERNAME"), password=passkey, ) + # If the user inserts a thread link, pick that one + if os.getenv("THREAD_LINK"): - if os.getenv("SUBREDDIT"): - subreddit = reddit.subreddit(os.getenv("SUBREDDIT")) + print_step(f"Getting the inserted thread...") + + thread_id = os.getenv("THREAD_LINK").split("/")[6] + submission = reddit.submission(thread_id) else: - # ! Prompt the user to enter a subreddit - try: - subreddit = reddit.subreddit( - input("What subreddit would you like to pull from? ") - ) - except ValueError: - subreddit = reddit.subreddit("askreddit") - print_substep("Subreddit not defined. Using AskReddit.") + # Otherwise, picks a random thread from the inserted subreddit + if os.getenv("SUBREDDIT"): + subreddit_name = os.getenv("SUBREDDIT") + print_step(f"Getting a random thread from r/{subreddit_name}") + subreddit = reddit.subreddit(subreddit_name) + else: + # ! Prompt the user to enter a subreddit + try: + subreddit = reddit.subreddit( + input("What subreddit would you like to pull from? ") + ) + except ValueError: + subreddit = reddit.subreddit("askreddit") + print_substep("Subreddit not defined. Using AskReddit.") + + threads = subreddit.hot(limit=25) + submission = list(threads)[random.randrange(0, 25)] + + - threads = subreddit.hot(limit=25) - submission = list(threads)[random.randrange(0, 25)] print_substep(f"Video will be: {submission.title} :thumbsup:") try: - content["thread_url"] = submission.url content["thread_title"] = submission.title content["comments"] = [] From 6ec947523273e7ba6c09be85b2cd37e76bbe72bb Mon Sep 17 00:00:00 2001 From: MeDBeD1 <82283979+MeDBeD1@users.noreply.github.com> Date: Sat, 4 Jun 2022 08:47:24 +1000 Subject: [PATCH 34/77] First 2 files of requested changes --- video_creation/final_video.py | 3 ++- video_creation/voices.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index e1f71ff..7dd8d02 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -29,6 +29,7 @@ def make_final_video(number_of_clips): for i in range(0, number_of_clips): audio_clips.append(AudioFileClip(f"assets/mp3/{i}.mp3")) audio_clips.insert(0, AudioFileClip(f"assets/mp3/title.mp3")) + audio_clips.insert(1, AudioFileClip(f"assets/mp3/posttext.mp3")) audio_concat = concatenate_audioclips(audio_clips) audio_composite = CompositeAudioClip([audio_concat]) @@ -44,7 +45,7 @@ def make_final_video(number_of_clips): image_clips.insert( 0, ImageClip(f"assets/png/title.png") - .set_duration(audio_clips[0].duration) + .set_duration(audio_clips[0].duration + audio_clips[1].duration) .set_position("center") .resize(width=W - 100), ) diff --git a/video_creation/voices.py b/video_creation/voices.py index e8d8e43..b4650e6 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -21,6 +21,10 @@ def save_text_to_mp3(reddit_obj): tts.save(f"assets/mp3/title.mp3") length += MP3(f"assets/mp3/title.mp3").info.length + tts = gTTS(text=reddit_obj["thread_post"], lang="en", slow=False) + tts.save(f"assets/mp3/posttext.mp3") + length += MP3(f"assets/mp3/posttext.mp3").info.length + for idx, comment in track(enumerate(reddit_obj["comments"]), "Saving..."): # ! Stop creating mp3 files if the length is greater than 50 seconds. This can be longer, but this is just a good starting point if length > 50: From 2fbb369f8a70905f98a5b2b055e1f8073927d57c Mon Sep 17 00:00:00 2001 From: MeDBeD1 <82283979+MeDBeD1@users.noreply.github.com> Date: Sat, 4 Jun 2022 08:48:10 +1000 Subject: [PATCH 35/77] the 3rd file of requested changes --- reddit/subreddit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index e9ae4fe..66148d5 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -54,7 +54,8 @@ def get_subreddit_threads(): try: content["thread_url"] = submission.url - content["thread_title"] = submission.title + submission.selftext + content["thread_title"] = submission.title + content["thread_post"] = submission.selftext content["comments"] = [] for top_level_comment in submission.comments: From 5555b80bc8c39e90309e6edb8bb4f021f5bcc058 Mon Sep 17 00:00:00 2001 From: Domiziano Scarcelli Date: Sat, 4 Jun 2022 01:00:08 +0200 Subject: [PATCH 36/77] Removed IDE files from git tracking Removed IDE files from git tracking Removed IDE files from git tracking --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 4 +++- .idea/.gitignore | 3 --- .idea/RedditVideoMakerBot.iml | 14 -------------- .idea/inspectionProfiles/profiles_settings.xml | 6 ------ .idea/misc.xml | 4 ---- .idea/modules.xml | 8 -------- .idea/vcs.xml | 6 ------ 8 files changed, 3 insertions(+), 42 deletions(-) delete mode 100644 .DS_Store delete mode 100644 .idea/.gitignore delete mode 100644 .idea/RedditVideoMakerBot.iml delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index d9fbee9a2d2bee2e47c875e2dc0b7508612c6686..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%}T>S5Z<-5Nhm@N3OxqA7OX+k;w8lT0!H+pQWFw17_+5G?V%KM))(?gd>&_Z zH-})rn~0q$yWi~m>}Edb{xHV4zlaYRvl(M1G(?U{i=esHwWWg*xtyb9MYJqtQ6{36 ziTU6hzhG7|f<34y2%b*O)Md63@TO3^pkwvv0 zM%QVwoZ7qRA}_-J%3)ciHMIw;m3urII_~Modg!di zF6c*NcfGdEz5Ro;%jt9Wl8ZM*BnQr=>}agv9h62*ufaUeME(f&I;V~$BnF59Vt^Rf zJO=bxVD>k!bgGybAO?P50QUz68ltDMQYg0$=km;3^&Lj*jy*Rti-*<8oz~N3UEzUbtKx?2Zg)+*3$BF+dD78R)2?jpzRb{AF4n z`OOp>5d*})KVyJ*C&9#rqV(DNtvozy9cT~GP%y4S1qAfQB>)Dvj|`+!`5n|D&eK>a V#97cT(*fxsAPJ$482AMSz5umqOj-Z{ diff --git a/.gitignore b/.gitignore index b541305..28b6807 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ assets/ .env reddit-bot-351418-5560ebc49cac.json -__pycache__ \ No newline at end of file +__pycache__ +.idea/ +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/RedditVideoMakerBot.iml b/.idea/RedditVideoMakerBot.iml deleted file mode 100644 index 8e5446a..0000000 --- a/.idea/RedditVideoMakerBot.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 653ebc1..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 1fd5644..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From ccd0c60d874a97c0f0d0a092c8412c38e33967b7 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 00:31:56 +0100 Subject: [PATCH 37/77] Add default values for environment variables This should reduce errors by some values not being set in the .env file - namely 2FA and Theme --- main.py | 2 +- reddit/subreddit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 8cc3c9a..57256df 100644 --- a/main.py +++ b/main.py @@ -20,7 +20,7 @@ reddit_object = get_subreddit_threads() load_dotenv() length, number_of_comments = save_text_to_mp3(reddit_object) -download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME")) +download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME", "light")) download_background() chop_background_video(length) final_video = make_final_video(number_of_comments) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 5d020fe..c7714ce 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -15,7 +15,7 @@ def get_subreddit_threads(): print_step("Getting AskReddit threads...") - if os.getenv("REDDIT_2FA").lower() == "yes": + if os.getenv("REDDIT_2FA", default="no").lower() == "yes": print( "\nEnter your two-factor authentication code from your authenticator app.\n" ) From f05eff4f88402b53c1dc919c6e793dea628c3da3 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 01:30:10 +0100 Subject: [PATCH 38/77] Alert user if their .env is not configured properly --- main.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 57256df..dff9645 100644 --- a/main.py +++ b/main.py @@ -1,13 +1,13 @@ from utils.console import print_markdown -import time - from reddit.subreddit import get_subreddit_threads from video_creation.background import download_background, chop_background_video from video_creation.voices import save_text_to_mp3 from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts from video_creation.final_video import make_final_video from dotenv import load_dotenv -import os +import os, time + +REQUIRED_VALUES = ["REDDIT_CLIENT_ID","REDDIT_CLIENT_SECRET","REDDIT_USERNAME","REDDIT_PASSWORD"] print_markdown( "### Thanks for using this tool! [Feel free to contribute to this project on GitHub!](https://lewismenelaws.com) If you have any questions, feel free to reach out to me on Twitter or submit a GitHub issue." @@ -15,10 +15,17 @@ print_markdown( time.sleep(3) +load_dotenv() -reddit_object = get_subreddit_threads() +configured = True -load_dotenv() +for val in REQUIRED_VALUES: + if val not in os.environ or not os.getenv(val): + print(f"Please set the variable \"{val}\" in your .env file.") + configured = False + +if configured: +reddit_object = get_subreddit_threads() length, number_of_comments = save_text_to_mp3(reddit_object) download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME", "light")) download_background() From 87d211281220ea529e6b48008e884a2adb7cd5f9 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 01:40:55 +0100 Subject: [PATCH 39/77] Move to casefold --- reddit/subreddit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index c7714ce..c64db2b 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -15,7 +15,7 @@ def get_subreddit_threads(): print_step("Getting AskReddit threads...") - if os.getenv("REDDIT_2FA", default="no").lower() == "yes": + if os.getenv("REDDIT_2FA", default="no").casefold() == "yes": print( "\nEnter your two-factor authentication code from your authenticator app.\n" ) From 3a7d91f474de5bbfdab0113b8479b0378949c943 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 01:41:48 +0100 Subject: [PATCH 40/77] Create a .env file if none exists on run Should fix issues users have with creating their own .env file, by simply copying our template to a file for them. --- main.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index dff9645..b813c01 100644 --- a/main.py +++ b/main.py @@ -5,7 +5,7 @@ from video_creation.voices import save_text_to_mp3 from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts from video_creation.final_video import make_final_video from dotenv import load_dotenv -import os, time +import os, time, shutil REQUIRED_VALUES = ["REDDIT_CLIENT_ID","REDDIT_CLIENT_SECRET","REDDIT_USERNAME","REDDIT_PASSWORD"] @@ -19,15 +19,19 @@ load_dotenv() configured = True +if not os.path.exists(".env"): + shutil.copy(".env.template", ".env") + configured = False + for val in REQUIRED_VALUES: if val not in os.environ or not os.getenv(val): print(f"Please set the variable \"{val}\" in your .env file.") configured = False if configured: -reddit_object = get_subreddit_threads() -length, number_of_comments = save_text_to_mp3(reddit_object) -download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME", "light")) -download_background() -chop_background_video(length) -final_video = make_final_video(number_of_comments) + reddit_object = get_subreddit_threads() + length, number_of_comments = save_text_to_mp3(reddit_object) + download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME", "light")) + download_background() + chop_background_video(length) + final_video = make_final_video(number_of_comments) From d39386178b254f7bb86837c728fec20cb1dd52de Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 01:53:34 +0100 Subject: [PATCH 41/77] Clean up imports --- reddit/subreddit.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 5d020fe..95d26e7 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -1,8 +1,6 @@ from utils.console import print_markdown, print_step, print_substep -import praw -import random from dotenv import load_dotenv -import os +import os, random, praw, re def get_subreddit_threads(): From cd5924562f021fcd95c8313cf9b8ee5cfc01185c Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 01:57:09 +0100 Subject: [PATCH 42/77] Ignore r/ in subreddit names --- reddit/subreddit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 95d26e7..e1be0c3 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -40,7 +40,7 @@ def get_subreddit_threads(): # ! Prompt the user to enter a subreddit try: subreddit = reddit.subreddit( - input("What subreddit would you like to pull from? ") + re.sub(r"r\/", "", input("What subreddit would you like to pull from? ")) ) except ValueError: subreddit = reddit.subreddit("askreddit") From 37f22b8b018dd85d3b8db1b4fa9df282a55133cc Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 02:00:19 +0100 Subject: [PATCH 43/77] Ignore r/ in environment subreddit names --- reddit/subreddit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index e1be0c3..32bcba3 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -35,7 +35,7 @@ def get_subreddit_threads(): ) if os.getenv("SUBREDDIT"): - subreddit = reddit.subreddit(os.getenv("SUBREDDIT")) + subreddit = reddit.subreddit(re.sub(r"r\/", "", os.getenv("SUBREDDIT"))) else: # ! Prompt the user to enter a subreddit try: From d3b288008fbe1f67f9fcddcbf17783493f339ddf Mon Sep 17 00:00:00 2001 From: Kamushy <92086533+Kamushy@users.noreply.github.com> Date: Sat, 4 Jun 2022 11:03:13 +1000 Subject: [PATCH 44/77] Changed function name to match new version --- reddit/subreddit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 09f4477..1f49152 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -4,7 +4,7 @@ import random from dotenv import load_dotenv import os -def get_askreddit_threads(): +def get_subreddit_threads(): global submission """ Returns a list of threads from the AskReddit subreddit. From 367105fb2dd33cdbf1ae6730036509d82e00531e Mon Sep 17 00:00:00 2001 From: Kamushy <92086533+Kamushy@users.noreply.github.com> Date: Sat, 4 Jun 2022 11:04:30 +1000 Subject: [PATCH 45/77] Changed file import name and resolved conflicts --- video_creation/final_video.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index ba169f0..366f61d 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -7,7 +7,7 @@ from moviepy.editor import ( CompositeAudioClip, CompositeVideoClip, ) -import reddit.askreddit +import reddit.subreddit import re from utils.console import print_step @@ -58,7 +58,7 @@ def make_final_video(number_of_clips): ) image_concat.audio = audio_composite final = CompositeVideoClip([background_clip, image_concat]) - filename = (re.sub('[?\"%*:|<>]', '', ("assets/" + reddit.askreddit.submission.title + ".mp4"))) + filename = (re.sub('[?\"%*:|<>]', '', ("assets/" + reddit.subreddit.submission.title + ".mp4"))) final.write_videofile(filename, fps=30, audio_codec="aac", audio_bitrate="192k") for i in range(0, number_of_clips): pass From 2ef606fe29d818cbb666fbddddf9aabd727cdf8b Mon Sep 17 00:00:00 2001 From: MeDBeD1 <82283979+MeDBeD1@users.noreply.github.com> Date: Sat, 4 Jun 2022 16:52:37 +1000 Subject: [PATCH 46/77] Fixed a bug: an error if the thread has no selftext Had to implement a few checks for the thread having selftext and for selftext tts file to exist --- video_creation/final_video.py | 31 ++++++++++++++++++++++--------- video_creation/voices.py | 7 ++++--- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 7dd8d02..6f2fbbf 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -8,7 +8,7 @@ from moviepy.editor import ( CompositeVideoClip, ) from utils.console import print_step - +from pathlib import Path W, H = 1080, 1920 @@ -29,7 +29,10 @@ def make_final_video(number_of_clips): for i in range(0, number_of_clips): audio_clips.append(AudioFileClip(f"assets/mp3/{i}.mp3")) audio_clips.insert(0, AudioFileClip(f"assets/mp3/title.mp3")) - audio_clips.insert(1, AudioFileClip(f"assets/mp3/posttext.mp3")) + try: + audio_clips.insert(1, AudioFileClip(f"assets/mp3/posttext.mp3")) + except: + OSError() audio_concat = concatenate_audioclips(audio_clips) audio_composite = CompositeAudioClip([audio_concat]) @@ -42,13 +45,23 @@ def make_final_video(number_of_clips): .set_position("center") .resize(width=W - 100), ) - image_clips.insert( - 0, - ImageClip(f"assets/png/title.png") - .set_duration(audio_clips[0].duration + audio_clips[1].duration) - .set_position("center") - .resize(width=W - 100), - ) + + if Path(f"assets/mp3/posttext.mp3").is_file(): #audio_clips[1] == AudioFileClip(f"assets/mp3/0.mp3"): + image_clips.insert( + 0, + ImageClip(f"assets/png/title.png") + .set_duration(audio_clips[0].duration + audio_clips[1].duration) + .set_position("center") + .resize(width=W - 100), + ) + else: + image_clips.insert( + 0, + ImageClip(f"assets/png/title.png") + .set_duration(audio_clips[0].duration) + .set_position("center") + .resize(width=W - 100), + ) image_concat = concatenate_videoclips(image_clips).set_position( ("center", "center") ) diff --git a/video_creation/voices.py b/video_creation/voices.py index b4650e6..56a2b23 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -21,9 +21,10 @@ def save_text_to_mp3(reddit_obj): tts.save(f"assets/mp3/title.mp3") length += MP3(f"assets/mp3/title.mp3").info.length - tts = gTTS(text=reddit_obj["thread_post"], lang="en", slow=False) - tts.save(f"assets/mp3/posttext.mp3") - length += MP3(f"assets/mp3/posttext.mp3").info.length + if reddit_obj["thread_post"] != "": + tts = gTTS(text=reddit_obj["thread_post"], lang="en", slow=False) + tts.save(f"assets/mp3/posttext.mp3") + length += MP3(f"assets/mp3/posttext.mp3").info.length for idx, comment in track(enumerate(reddit_obj["comments"]), "Saving..."): # ! Stop creating mp3 files if the length is greater than 50 seconds. This can be longer, but this is just a good starting point From d59fb5bdf28b1158845f094cb25913262e3bea45 Mon Sep 17 00:00:00 2001 From: Domiziano Scarcelli Date: Sat, 4 Jun 2022 09:53:23 +0200 Subject: [PATCH 47/77] Changed THREAD to THREAD_LINK inside .env.template --- .env.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.template b/.env.template index 9e2218f..c2a2fcf 100644 --- a/.env.template +++ b/.env.template @@ -11,4 +11,4 @@ SUBREDDIT="askReddit" # Link of the thread # (e.g. https://www.reddit.com/r/memes/comments/sbr31o/discordggrmemes_the_official_rmemes_discord_server/) -THREAD="" \ No newline at end of file +THREAD_LINK="" \ No newline at end of file From 03f96e7a89780fb3ec8d8df16ff9653fa6cfed79 Mon Sep 17 00:00:00 2001 From: Luka Hietala <95122845+LukaHietala@users.noreply.github.com> Date: Sat, 4 Jun 2022 14:48:13 +0300 Subject: [PATCH 48/77] Fixed link to documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 10e84e9..dbb0250 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p 5. Run `python3 main.py` 6. Enjoy 😎 -If you want to see more detailed guide, please refer to the official [documentation](https://immaharry.gitbook.io/reddit-automated-video-bot/). +If you want to see more detailed guide, please refer to the official [documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/). *The Documentation is still being developed and worked on, please be patient as we change / add new knowledge! ## Contributing & Ways to improve πŸ“ˆ From 5f2070d34497d6e2bfa5716f4dffdf53a96c3fe8 Mon Sep 17 00:00:00 2001 From: jacesleeman <46321222+jacesleeman@users.noreply.github.com> Date: Sat, 4 Jun 2022 09:04:43 -0400 Subject: [PATCH 49/77] Added opacity setting to the screen shots --- .env.template | 3 +++ video_creation/final_video.py | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.env.template b/.env.template index 5ab4ae4..43cb7d9 100644 --- a/.env.template +++ b/.env.template @@ -9,3 +9,6 @@ REDDIT_2FA="" THEME="" SUBREDDIT="" + +# Range is 0 -> 1 +OPACITY="" diff --git a/video_creation/final_video.py b/video_creation/final_video.py index e1f71ff..9db757e 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -8,12 +8,18 @@ from moviepy.editor import ( CompositeVideoClip, ) from utils.console import print_step - +from dotenv import load_dotenv +import os W, H = 1080, 1920 + def make_final_video(number_of_clips): + # Calls opacity from the .env + load_dotenv() + opacity = os.getenv('OPACITY') + print_step("Creating the final video...") VideoFileClip.reW = lambda clip: clip.resize(width=W) VideoFileClip.reH = lambda clip: clip.resize(width=H) @@ -39,14 +45,16 @@ def make_final_video(number_of_clips): ImageClip(f"assets/png/comment_{i}.png") .set_duration(audio_clips[i + 1].duration) .set_position("center") - .resize(width=W - 100), + .resize(width=W - 100) + .set_opacity(float(opacity)), ) image_clips.insert( 0, ImageClip(f"assets/png/title.png") .set_duration(audio_clips[0].duration) .set_position("center") - .resize(width=W - 100), + .resize(width=W - 100) + .set_opacity(float(opacity)), ) image_concat = concatenate_videoclips(image_clips).set_position( ("center", "center") From 84c8eb25ce3a8735dfb9486330647006e4891a5f Mon Sep 17 00:00:00 2001 From: jacesleeman <46321222+jacesleeman@users.noreply.github.com> Date: Sat, 4 Jun 2022 10:02:01 -0400 Subject: [PATCH 50/77] updated .env to explain better --- .env.template | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.env.template b/.env.template index 43cb7d9..5115d89 100644 --- a/.env.template +++ b/.env.template @@ -3,12 +3,13 @@ REDDIT_CLIENT_SECRET="" REDDIT_USERNAME="" REDDIT_PASSWORD="" -# Valid options are "yes" and "no" for the variable below +SUBREDDIT="" + +# Valid options are "yes" and "no" REDDIT_2FA="" +# Valid options are "light "dark" THEME="" -SUBREDDIT="" - # Range is 0 -> 1 OPACITY="" From 102f791684caddfdd3bb7de1b63c3391790e565b Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 15:43:21 +0100 Subject: [PATCH 51/77] Update .env.template --- .env.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.template b/.env.template index 5115d89..58f3fd3 100644 --- a/.env.template +++ b/.env.template @@ -8,8 +8,8 @@ SUBREDDIT="" # Valid options are "yes" and "no" REDDIT_2FA="" -# Valid options are "light "dark" +# Valid options are "light" and "dark" THEME="" # Range is 0 -> 1 -OPACITY="" +OPACITY="0.9" From fe92918823c0dbfc1dd03d7b675b0bfcb94b15b5 Mon Sep 17 00:00:00 2001 From: jacesleeman <46321222+jacesleeman@users.noreply.github.com> Date: Sat, 4 Jun 2022 10:59:07 -0400 Subject: [PATCH 52/77] updated --- .env.template | 2 +- main.py | 2 ++ video_creation/final_video.py | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.env.template b/.env.template index 43cb7d9..d90bac7 100644 --- a/.env.template +++ b/.env.template @@ -11,4 +11,4 @@ THEME="" SUBREDDIT="" # Range is 0 -> 1 -OPACITY="" +OPACITY=".9" diff --git a/main.py b/main.py index 8cc3c9a..b0a4c28 100644 --- a/main.py +++ b/main.py @@ -9,6 +9,8 @@ from video_creation.final_video import make_final_video from dotenv import load_dotenv import os +REQUIRED_VALUES = ["REDDIT_CLIENT_ID","REDDIT_CLIENT_SECRET","REDDIT_USERNAME","REDDIT_PASSWORD", "OPACITY"] + print_markdown( "### Thanks for using this tool! [Feel free to contribute to this project on GitHub!](https://lewismenelaws.com) If you have any questions, feel free to reach out to me on Twitter or submit a GitHub issue." ) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 9db757e..0a2afb0 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -30,6 +30,11 @@ def make_final_video(number_of_clips): .resize(height=H) .crop(x1=1166.6, y1=0, x2=2246.6, y2=1920) ) + try: + float(os.getenv("OPACITY")) + except: + print(f"Please ensure that OPACITY is set between 0 and 1 in your .env file") + configured = False # Gather all audio clips audio_clips = [] for i in range(0, number_of_clips): From c318e4e0425f288a7189ea9ec6e2f2361367a973 Mon Sep 17 00:00:00 2001 From: jacesleeman <46321222+jacesleeman@users.noreply.github.com> Date: Sat, 4 Jun 2022 11:06:52 -0400 Subject: [PATCH 53/77] default OPACITY --- .env.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.template b/.env.template index a7f6dd3..3fc5e13 100644 --- a/.env.template +++ b/.env.template @@ -12,4 +12,4 @@ THEME="" SUBREDDIT="" # Range is 0 -> 1 -OPACITY="" \ No newline at end of file +OPACITY=".9" From b9ffdd186d1638da22d9d725a320afd5e795047c Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 16:09:26 +0100 Subject: [PATCH 54/77] Added a zero to make it clearer to users --- .env.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.template b/.env.template index 3fc5e13..cab265e 100644 --- a/.env.template +++ b/.env.template @@ -12,4 +12,4 @@ THEME="" SUBREDDIT="" # Range is 0 -> 1 -OPACITY=".9" +OPACITY="0.9" From 0dc32154f2ccce46daf1d5751a9d4f5426e6c5bc Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 16:16:02 +0100 Subject: [PATCH 55/77] Code was placed in the wrong place --- main.py | 6 ++++++ video_creation/final_video.py | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index fc12206..3bc6c83 100644 --- a/main.py +++ b/main.py @@ -30,6 +30,12 @@ for val in REQUIRED_VALUES: print(f"Please set the variable \"{val}\" in your .env file.") configured = False +try: + float(os.getenv("OPACITY")) +except: + print(f"Please ensure that OPACITY is set between 0 and 1 in your .env file") + configured = False + if configured: reddit_object = get_subreddit_threads() length, number_of_comments = save_text_to_mp3(reddit_object) diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 0a2afb0..1933db3 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -30,11 +30,7 @@ def make_final_video(number_of_clips): .resize(height=H) .crop(x1=1166.6, y1=0, x2=2246.6, y2=1920) ) - try: - float(os.getenv("OPACITY")) - except: - print(f"Please ensure that OPACITY is set between 0 and 1 in your .env file") - configured = False + # Gather all audio clips audio_clips = [] for i in range(0, number_of_clips): From 48688f18c642177cda0a9eb421ce0c3c126c0f42 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 16:19:58 +0100 Subject: [PATCH 56/77] Remove code duplication --- main.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/main.py b/main.py index 3bc6c83..1b66e8c 100644 --- a/main.py +++ b/main.py @@ -7,8 +7,6 @@ from video_creation.final_video import make_final_video from dotenv import load_dotenv import os, time, shutil -REQUIRED_VALUES = ["REDDIT_CLIENT_ID","REDDIT_CLIENT_SECRET","REDDIT_USERNAME","REDDIT_PASSWORD"] - REQUIRED_VALUES = ["REDDIT_CLIENT_ID","REDDIT_CLIENT_SECRET","REDDIT_USERNAME","REDDIT_PASSWORD", "OPACITY"] print_markdown( From 211b03e7f5cc4e8c92778f50d80cf9e82f83790c Mon Sep 17 00:00:00 2001 From: null3000 <76852813+null3000@users.noreply.github.com> Date: Sun, 5 Jun 2022 00:31:59 +0200 Subject: [PATCH 57/77] stickied comments will no longer be used I made a video but it was taken up entirely by a post looking like this: https://imgur.com/a/1fwT94c This isn't a big deal because these serious tags are uncommon, but still a small annoyance. So I fixed it! In threads that are marked 'serious', there is an automatic stickied mod post. ex. (shorturl.at/I1346). My changes will skip any automatically stickied comments, so they won't make it into the final Video. --- reddit/subreddit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 1d47974..063b862 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -56,6 +56,7 @@ def get_subreddit_threads(): content["comments"] = [] for top_level_comment in submission.comments: + if not top_level_comment.stickied: content["comments"].append( { "comment_body": top_level_comment.body, From 3115155d894329a4e94bb82cd18e56d3a0c96289 Mon Sep 17 00:00:00 2001 From: MeDBeD1 <82283979+MeDBeD1@users.noreply.github.com> Date: Sun, 5 Jun 2022 08:59:26 +1000 Subject: [PATCH 58/77] Added a check for selftext if selftext file exists it gets deleted and recreated if it is present in the thread --- video_creation/voices.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/video_creation/voices.py b/video_creation/voices.py index 56a2b23..c0df8b7 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -21,6 +21,11 @@ def save_text_to_mp3(reddit_obj): tts.save(f"assets/mp3/title.mp3") length += MP3(f"assets/mp3/title.mp3").info.length + try: + Path(f"assets/mp3/posttext.mp3").unlink() + except OSError as e: + pass + if reddit_obj["thread_post"] != "": tts = gTTS(text=reddit_obj["thread_post"], lang="en", slow=False) tts.save(f"assets/mp3/posttext.mp3") From f51cbbce4d95a3427eb14f22fe59f6135052f5c0 Mon Sep 17 00:00:00 2001 From: Domiziano Scarcelli Date: Sun, 5 Jun 2022 11:10:03 +0200 Subject: [PATCH 59/77] The script asks the user for the thread link in the console --- .env.template | 5 ++--- reddit/subreddit.py | 13 ++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.env.template b/.env.template index 25936d2..9385e68 100644 --- a/.env.template +++ b/.env.template @@ -12,6 +12,5 @@ SUBREDDIT="askReddit" THEME="" -# Link of the thread -# (e.g. https://www.reddit.com/r/memes/comments/sbr31o/discordggrmemes_the_official_rmemes_discord_server/) -THREAD_LINK="" \ No newline at end of file +#If no, it will ask you a thread link to extract the thread, if yes it will randomize it. +RANDOM_THREAD="no" \ No newline at end of file diff --git a/reddit/subreddit.py b/reddit/subreddit.py index c2f6547..b83b0e3 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -1,3 +1,6 @@ +from webbrowser import get + +from click import style from utils.console import print_markdown, print_step, print_substep import praw import random @@ -34,12 +37,12 @@ def get_subreddit_threads(): username=os.getenv("REDDIT_USERNAME"), password=passkey, ) - # If the user inserts a thread link, pick that one - if os.getenv("THREAD_LINK"): - + # If the user specifies that he doesnt want a random thread, or if he doesn't insert the "RANDOM_THREAD" variable at all, ask the thread link + if not os.getenv("RANDOM_THREAD") or os.getenv("RANDOM_THREAD") == "no": + print_substep("Insert the full thread link:", style="bold green") + thread_link = input() print_step(f"Getting the inserted thread...") - - thread_id = os.getenv("THREAD_LINK").split("/")[6] + thread_id = thread_link.split("/")[6] submission = reddit.submission(thread_id) else: # Otherwise, picks a random thread from the inserted subreddit From 49da171b55f562378d01f3bf2a8aa8decd45b2d8 Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Sun, 5 Jun 2022 07:35:45 -0400 Subject: [PATCH 60/77] Add OPACITY, SUBREDDIT, and THEME. --- setup.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f49b03b..feaa344 100644 --- a/setup.py +++ b/setup.py @@ -56,6 +56,9 @@ console.log("[bold green]Reddit Client Secret") console.log("[bold green]Reddit Username") console.log("[bold green]Reddit Password") console.log("[bold green]Reddit 2FA (yes or no)") +console.log("[bold green]Opacity (range of 0-1, decimals are OK)") +console.log("[bold green]Subreddit (without r/ or /r/)") +console.log("[bold green]Theme (light or dark)") time.sleep(0.5) console.print("[green]If you don't have these, please follow the instructions in the README.md file to set them up.") console.print("[green]If you do have these, type yes to continue. If you dont, go ahead and grab those quickly and come back.") @@ -80,6 +83,9 @@ cliSec = input("Client Secret > ") user = input("Username > ") passw = input("Password > ") twofactor = input("2fa Enabled? (yes/no) > ") +opacity = input("Opacity? (range of 0-1) > ") +subreddit = input("Subreddit (without r/) > ") +theme = input("Theme? (light or dark) > ") console.log("Attempting to save your credentials...") loader = Loader("Saving Credentials...", "Done!").start() # you can also put a while loop here, e.g. while VideoIsBeingMade == True: ... @@ -98,6 +104,12 @@ with open('.env', 'a') as f: f.write(f'REDDIT_PASSWORD="{passw}"\n') time.sleep(0.5) f.write(f'REDDIT_2FA="{twofactor}"\n') + time.sleep(0.5) + f.write(f'THEME="{theme}"\n') + time.sleep(0.5) + f.write(f'SUBREDDIT="{subreddit}"\n') + time.sleep(0.5) + f.write(f'OPACITY="{opacity}"\n') with open('.setup-done-before', 'a') as f: f.write("This file blocks the setup assistant from running again. Delete this file to run setup again.") @@ -107,4 +119,4 @@ loader.stop() console.log("[bold green]Setup Complete! Returning...") # Post-Setup: send message and try to run main.py again. -os.system("python3 main.py") \ No newline at end of file +os.system("python3 main.py") From aa67002b903bf7db3c7ab933c6e9471481518b68 Mon Sep 17 00:00:00 2001 From: Domiziano Scarcelli Date: Sun, 5 Jun 2022 17:15:39 +0200 Subject: [PATCH 61/77] Modified readme and removed a useless line of code --- README.md | 21 +++++++++++---------- reddit/subreddit.py | 3 +-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index dbb0250..f9d8c12 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ All done WITHOUT video editing or asset compiling. Just pure ✨programming magi Created by Lewis Menelaws & [TMRRW](https://tmrrwinc.ca) [ + @@ -20,13 +21,13 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p ## Disclaimers 🚨 -- This is purely for fun purposes. -- **At the moment**, this repository won't attempt to upload this content through this bot. It will give you a file that you will then have to upload manually. This is for the sake of avoiding any sort of community guideline issues. +- This is purely for fun purposes. +- **At the moment**, this repository won't attempt to upload this content through this bot. It will give you a file that you will then have to upload manually. This is for the sake of avoiding any sort of community guideline issues. ## Requirements -- Python 3.6+ -- Playwright (this should install automatically during installation) +- Python 3.6+ +- Playwright (this should install automatically during installation) ## Installation πŸ‘©β€πŸ’» @@ -38,7 +39,7 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p 6. Enjoy 😎 If you want to see more detailed guide, please refer to the official [documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/). -*The Documentation is still being developed and worked on, please be patient as we change / add new knowledge! +\*The Documentation is still being developed and worked on, please be patient as we change / add new knowledge! ## Contributing & Ways to improve πŸ“ˆ @@ -46,8 +47,8 @@ In its current state, this bot does exactly what it needs to do. However, lots o I have tried to simplify the code so anyone can read it and start contributing at any skill level. Don't be shy :) contribute! -- [ ] Allowing users to choose a reddit thread instead of being randomized. -- [ ] Allowing users to choose a background that is picked instead of the Minecraft one. -- [x] Allowing users to choose between any subreddit. -- [ ] Allowing users to change voice. -- [ ] Creating better documentation and adding a command line interface. +- [x] Allowing users to choose a reddit thread instead of being randomized. +- [ ] Allowing users to choose a background that is picked instead of the Minecraft one. +- [x] Allowing users to choose between any subreddit. +- [ ] Allowing users to change voice. +- [ ] Creating better documentation and adding a command line interface. diff --git a/reddit/subreddit.py b/reddit/subreddit.py index e74b8a1..16bbb79 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -39,8 +39,7 @@ def get_subreddit_threads(): print_substep("Insert the full thread link:", style="bold green") thread_link = input() print_step(f"Getting the inserted thread...") - thread_id = thread_link.split("/")[6] - submission = reddit.submission(thread_id) + submission = reddit.submission(url=thread_link) else: # Otherwise, picks a random thread from the inserted subreddit if os.getenv("SUBREDDIT"): From c6ab604c186e892b962f026e69997753edf8d83a Mon Sep 17 00:00:00 2001 From: Lewis Menelaws Date: Sun, 5 Jun 2022 13:44:12 -0400 Subject: [PATCH 62/77] Fixed a couple of issues.. --- main.py | 84 +++++++++++++++++++++++++++------------------ reddit/subreddit.py | 25 ++++++++------ 2 files changed, 65 insertions(+), 44 deletions(-) diff --git a/main.py b/main.py index 689ca14..6ebb0ea 100644 --- a/main.py +++ b/main.py @@ -11,12 +11,19 @@ from video_creation.screenshot_downloader import download_screenshots_of_reddit_ from video_creation.final_video import make_final_video from utils.loader import Loader from dotenv import load_dotenv + console = Console() from dotenv import load_dotenv import os, time, shutil configured = True -REQUIRED_VALUES = ["REDDIT_CLIENT_ID","REDDIT_CLIENT_SECRET","REDDIT_USERNAME","REDDIT_PASSWORD", "OPACITY"] +REQUIRED_VALUES = [ + "REDDIT_CLIENT_ID", + "REDDIT_CLIENT_SECRET", + "REDDIT_USERNAME", + "REDDIT_PASSWORD", + "OPACITY", +] print_markdown( @@ -30,68 +37,77 @@ If there is a .env file, check if the required variables are set. If not, print """ -client_id=os.getenv("REDDIT_CLIENT_ID") -client_secret=os.getenv("REDDIT_CLIENT_SECRET") -username=os.getenv("REDDIT_USERNAME") -password=os.getenv("REDDIT_PASSWORD") -reddit2fa=os.getenv("REDDIT_2FA") +client_id = os.getenv("REDDIT_CLIENT_ID") +client_secret = os.getenv("REDDIT_CLIENT_SECRET") +username = os.getenv("REDDIT_USERNAME") +password = os.getenv("REDDIT_PASSWORD") +reddit2fa = os.getenv("REDDIT_2FA") +load_dotenv() console.log("[bold green]Checking environment variables...") time.sleep(1) + if not os.path.exists(".env"): shutil.copy(".env.template", ".env") configured = False console.log("[red] Your .env file is invalid, or was never created. Standby.") for val in REQUIRED_VALUES: + print(os.getenv(val)) if val not in os.environ or not os.getenv(val): - console.log(f"[bold red]Missing Variable: \"{val}\"") + console.log(f'[bold red]Missing Variable: "{val}"') configured = False - console.log("[red]Looks like you need to set your Reddit credentials in the .env file. Please follow the instructions in the README.md file to set them up.") - time.sleep(0.5) - console.log("[red]We can also launch the easy setup wizard. type yes to launch it, or no to quit the program.") - setup_ask = input("Launch setup wizard? > ") - if setup_ask=="yes": - console.log("[bold green]Here goes nothing! Launching setup wizard...") - time.sleep(0.5) - os.system("python3 setup.py") - else: - if setup_ask=="no": - console.print("[red]Exiting...") - time.sleep(0.5) - exit() - else: - console.print("[red]I don't understand that. Exiting...") - time.sleep(0.5) - exit() - - - exit() + console.log( + "[red]Looks like you need to set your Reddit credentials in the .env file. Please follow the instructions in the README.md file to set them up." + ) + time.sleep(0.5) + console.log( + "[red]We can also launch the easy setup wizard. type yes to launch it, or no to quit the program." + ) + setup_ask = input("Launch setup wizard? > ") + if setup_ask == "yes": + console.log("[bold green]Here goes nothing! Launching setup wizard...") + time.sleep(0.5) + os.system("python3 setup.py") + else: + if setup_ask == "no": + console.print("[red]Exiting...") + time.sleep(0.5) + exit() + else: + console.print("[red]I don't understand that. Exiting...") + time.sleep(0.5) + exit() + + exit() try: float(os.getenv("OPACITY")) except: - console.log(f"[red]Please ensure that OPACITY is set between 0 and 1 in your .env file") + console.log( + f"[red]Please ensure that OPACITY is set between 0 and 1 in your .env file" + ) configured = False exit() console.log("[bold green]Enviroment Variables are set! Continuing...") -load_dotenv() length, number_of_comments = save_text_to_mp3(reddit_object) -download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME")) +download_screenshots_of_reddit_posts( + reddit_object, number_of_comments, os.getenv("THEME") +) download_background() chop_background_video(length) final_video = make_final_video(number_of_comments) - - if configured: reddit_object = get_subreddit_threads() length, number_of_comments = save_text_to_mp3(reddit_object) - download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME", "light")) + download_screenshots_of_reddit_posts( + reddit_object, number_of_comments, os.getenv("THEME", "light") + ) download_background() chop_background_video(length) - final_video = make_final_video(number_of_comments) \ No newline at end of file + final_video = make_final_video(number_of_comments) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 9624e35..58ada57 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -1,8 +1,11 @@ -from rich import Console +from rich.console import Console from utils.console import print_markdown, print_step, print_substep from dotenv import load_dotenv + console = Console() import os, random, praw, re + + def get_subreddit_threads(): global submission """ @@ -39,7 +42,9 @@ def get_subreddit_threads(): # ! Prompt the user to enter a subreddit try: subreddit = reddit.subreddit( - re.sub(r"r\/", "", input("What subreddit would you like to pull from? ")) + re.sub( + r"r\/", "", input("What subreddit would you like to pull from? ") + ) ) except ValueError: subreddit = reddit.subreddit("askreddit") @@ -56,14 +61,14 @@ def get_subreddit_threads(): content["comments"] = [] for top_level_comment in submission.comments: - if not top_level_comment.stickied: - content["comments"].append( - { - "comment_body": top_level_comment.body, - "comment_url": top_level_comment.permalink, - "comment_id": top_level_comment.id, - } - ) + if not top_level_comment.stickied: + content["comments"].append( + { + "comment_body": top_level_comment.body, + "comment_url": top_level_comment.permalink, + "comment_id": top_level_comment.id, + } + ) except AttributeError as e: pass From 42f364d6227186253702e2aadd76aec29479631e Mon Sep 17 00:00:00 2001 From: Lewis Menelaws Date: Sun, 5 Jun 2022 13:48:58 -0400 Subject: [PATCH 63/77] Revert "Add Option for Male Voice" --- .env.template | 5 +---- main.py | 4 ++-- reddit/subreddit.py | 20 +++++++++----------- video_creation/voices.py | 22 +++++----------------- 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/.env.template b/.env.template index 5c66be2..cab265e 100644 --- a/.env.template +++ b/.env.template @@ -2,10 +2,7 @@ REDDIT_CLIENT_ID="" REDDIT_CLIENT_SECRET="" REDDIT_USERNAME="" REDDIT_PASSWORD="" -# Valid options are "female" and "male" -VOICE="female" - -# Valid options are "yes" and "no" for the variable below +# Valid options are "yes" and "no" REDDIT_2FA="" # Valid options are "light" and "dark" diff --git a/main.py b/main.py index 32f55e9..1b66e8c 100644 --- a/main.py +++ b/main.py @@ -35,8 +35,8 @@ except: configured = False if configured: - reddit_object = get_subreddit_threads(os.getenv("VOICE")) - length, number_of_comments = save_text_to_mp3(reddit_object, os.getenv("VOICE")) + reddit_object = get_subreddit_threads() + length, number_of_comments = save_text_to_mp3(reddit_object) download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME", "light")) download_background() chop_background_video(length) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index e9518a5..61c909d 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -2,7 +2,7 @@ from utils.console import print_markdown, print_step, print_substep from dotenv import load_dotenv import os, random, praw, re -def get_subreddit_threads(voice): +def get_subreddit_threads(): global submission """ Returns a list of threads from the AskReddit subreddit. @@ -55,16 +55,14 @@ def get_subreddit_threads(voice): content["comments"] = [] for top_level_comment in submission.comments: - if voice == "male" and len(top_level_comment.body) > 550: - continue - if not top_level_comment.stickied: - content["comments"].append( - { - "comment_body": top_level_comment.body, - "comment_url": top_level_comment.permalink, - "comment_id": top_level_comment.id, - } - ) + if not top_level_comment.stickied: + content["comments"].append( + { + "comment_body": top_level_comment.body, + "comment_url": top_level_comment.permalink, + "comment_id": top_level_comment.id, + } + ) except AttributeError as e: pass diff --git a/video_creation/voices.py b/video_creation/voices.py index bc14095..e8d8e43 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -3,10 +3,9 @@ from pathlib import Path from mutagen.mp3 import MP3 from utils.console import print_step, print_substep from rich.progress import track -import requests -def save_text_to_mp3(reddit_obj, voice): +def save_text_to_mp3(reddit_obj): """Saves Text to MP3 files. Args: @@ -18,29 +17,18 @@ def save_text_to_mp3(reddit_obj, voice): # Create a folder for the mp3 files. Path("assets/mp3").mkdir(parents=True, exist_ok=True) - generate_and_save_tts(voice, reddit_obj["thread_title"], "assets/mp3/title.mp3") + tts = gTTS(text=reddit_obj["thread_title"], lang="en", slow=False) + tts.save(f"assets/mp3/title.mp3") length += MP3(f"assets/mp3/title.mp3").info.length for idx, comment in track(enumerate(reddit_obj["comments"]), "Saving..."): # ! Stop creating mp3 files if the length is greater than 50 seconds. This can be longer, but this is just a good starting point if length > 50: break - - generate_and_save_tts(voice, comment["comment_body"], f"assets/mp3/{idx}.mp3") + tts = gTTS(text=comment["comment_body"], lang="en", slow=False) + tts.save(f"assets/mp3/{idx}.mp3") length += MP3(f"assets/mp3/{idx}.mp3").info.length print_substep("Saved Text to MP3 files successfully.", style="bold green") # ! Return the index so we know how many screenshots of comments we need to make. return length, idx - -def generate_and_save_tts(voice, text, file_name): - if voice == "female": - tts = gTTS(text=text, lang="en") - tts.save(file_name) - elif voice == "male": - url = 'https://streamlabs.com/polly/speak' - body = {'voice': 'Brian', 'text': text} - response = requests.post(url, data = body) - voice_data = requests.get(response.json()['speak_url']) - f = open(file_name, 'wb') - f.write(voice_data.content) \ No newline at end of file From e86c2bce041db04aa0f5971fea0021e5c7568d1e Mon Sep 17 00:00:00 2001 From: Lewis Menelaws Date: Sun, 5 Jun 2022 14:06:51 -0400 Subject: [PATCH 64/77] Removed unused imports. --- reddit/subreddit.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 16bbb79..a518d24 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -1,10 +1,8 @@ -from webbrowser import get - -from click import style from utils.console import print_markdown, print_step, print_substep from dotenv import load_dotenv import os, random, praw, re + def get_subreddit_threads(): global submission """ @@ -13,7 +11,6 @@ def get_subreddit_threads(): load_dotenv() - if os.getenv("REDDIT_2FA", default="no").casefold() == "yes": print( "\nEnter your two-factor authentication code from your authenticator app.\n" @@ -48,7 +45,11 @@ def get_subreddit_threads(): # ! Prompt the user to enter a subreddit try: subreddit = reddit.subreddit( - re.sub(r"r\/", "", input("What subreddit would you like to pull from? ")) + re.sub( + r"r\/", + "", + input("What subreddit would you like to pull from? "), + ) ) except ValueError: subreddit = reddit.subreddit("askreddit") @@ -64,14 +65,14 @@ def get_subreddit_threads(): content["comments"] = [] for top_level_comment in submission.comments: - if not top_level_comment.stickied: - content["comments"].append( - { - "comment_body": top_level_comment.body, - "comment_url": top_level_comment.permalink, - "comment_id": top_level_comment.id, - } - ) + if not top_level_comment.stickied: + content["comments"].append( + { + "comment_body": top_level_comment.body, + "comment_url": top_level_comment.permalink, + "comment_id": top_level_comment.id, + } + ) except AttributeError as e: pass From fea66a465c0bd406c698fb44fa5cf78d3ca8e0ab Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sun, 5 Jun 2022 20:03:30 +0100 Subject: [PATCH 65/77] Add contributing guidelines --- CONTRIBUTING.md | 109 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..643ea4c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,109 @@ +# Contributing to Reddit Video Maker Bot πŸŽ₯ + +Thanks for taking the time to contribute! ❀️ + +All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for the maintainers and smooth out the experience for all involved. We are looking forward to your contributions. πŸŽ‰ + +> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: +> +> - Star the project +> - Tweet about it +> - Refer this project in your project's readme + +## Table of Contents + +- [I Have a Question](#i-have-a-question) +- [I Want To Contribute](#i-want-to-contribute) +- [Reporting Bugs](#reporting-bugs) +- [Suggesting Enhancements](#suggesting-enhancements) +- [Your First Code Contribution](#your-first-code-contribution) +- [Improving The Documentation](#improving-the-documentation) + +## I Have a Question + +> If you want to ask a question, we assume that you have read the available [Documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/). + +Before you ask a question, it is best to search for existing [Issues](https://github.com/elebumm/RedditVideoMakerBot/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. + +If you then still feel the need to ask a question and need clarification, we recommend the following: + +- Open an [Issue](https://github.com/elebumm/RedditVideoMakerBot/issues/new). +- Provide as much context as you can about what you're running into. +- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. + +We will then take care of the issue as soon as possible. + +Additionally, there is a [discord channel](https://discord.gg/swqtb7AsNQ) for any questions you may have + +## I Want To Contribute + +### Reporting Bugs + +#### Before Submitting a Bug Report + +A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. + +- Make sure that you are using the latest version. +- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/). If you are looking for support, you might want to check [this section](#i-have-a-question)). +- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [issues](https://github.com/elebumm/RedditVideoMakerBot/). +- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue - you probably aren't the first to get the error! +- Collect information about the bug: + - Stack trace (Traceback) - preferably formatted in a code block. + - OS, Platform and Version (Windows, Linux, macOS, x86, ARM) + - Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. + - Your input and the output + - Is the issue reproducable? Does it exist in previous versions? + +#### How Do I Submit a Good Bug Report? + +We use GitHub issues to track bugs and errors. If you run into an issue with the project: + +- Open an [Issue](https://github.com/elebumm/RedditVideoMakerBot/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) +- Explain the behavior you would expect and the actual behavior. +- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. +- Provide the information you collected in the previous section. + +Once it's filed: + +- The project team will label the issue accordingly. +- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will try to support you as best as they can, but you may not recieve an instant. +- If the team discovers that this is an issue it will be marked `bug` or `error`, as well as possibly other tags relating to the nature of the error), and the issue will be left to be [implemented by someone](#your-first-code-contribution). + +### Suggesting Enhancements + +This section guides you through submitting an enhancement suggestion for Reddit Video Maker Bot, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. + +#### Before Submitting an Enhancement + +- Make sure that you are using the latest version. +- Read the [documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/) carefully and find out if the functionality is already covered, maybe by an individual configuration. +- Perform a [search](https://github.com/elebumm/RedditVideoMakerBot/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. +- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. + +#### How Do I Submit a Good Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](https://github.com/elebumm/RedditVideoMakerBot/issues). + +- Use a **clear and descriptive title** for the issue to identify the suggestion. +- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. +- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. +- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. +- **Explain why this enhancement would be useful** to most users. You may also want to point out the other projects that solved it better and which could serve as inspiration. + +### Your First Code Contribution + +#### Your environment + +You development environment should follow the requirements stated in the [README file](README.md). If you are not using the specified versions, **please reference this in your pull request**, so reviewers can test your code on both versions. + +#### Making your first PR + +When making your PR, follow these guidelines: + +- Your branch has a base of _develop_ **not** _master_ +- You are merging your branch into the _develop_ branch +- You link any issues that are resolved or fixed by your changes. (this is done by typing "Fixes #\") in your pull request. + +### Improving The Documentation + +All updates to the documentation should be made in a pull request to [this repo](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/) From 39ac0c7bc24150ca4c1ffae62e93389b41c58cca Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sun, 5 Jun 2022 20:03:43 +0100 Subject: [PATCH 66/77] Link contributing guidelines in README --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dbb0250..a79da04 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ All done WITHOUT video editing or asset compiling. Just pure ✨programming magi Created by Lewis Menelaws & [TMRRW](https://tmrrwinc.ca) [ + @@ -38,7 +39,7 @@ These videos on TikTok, YouTube and Instagram get MILLIONS of views across all p 6. Enjoy 😎 If you want to see more detailed guide, please refer to the official [documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/). -*The Documentation is still being developed and worked on, please be patient as we change / add new knowledge! +\*The Documentation is still being developed and worked on, please be patient as we change / add new knowledge! ## Contributing & Ways to improve πŸ“ˆ @@ -51,3 +52,5 @@ I have tried to simplify the code so anyone can read it and start contributing a - [x] Allowing users to choose between any subreddit. - [ ] Allowing users to change voice. - [ ] Creating better documentation and adding a command line interface. + +Please read our [contributing guidelines](CONTRIBUTING.md) for more detailed information. From f088c482ba8755732f421cfbc39c7e4e5ce36482 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sun, 5 Jun 2022 20:16:07 +0100 Subject: [PATCH 67/77] Add PR template --- .../pull_request_template.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..7fc8f80 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,21 @@ +# Description + + + +# Issue Fixes + + + +None + +# Checklist: + +- [ ] I am pushing to the **develop** branch +- [ ] I am using the recommended development environment +- [ ] I have performed a self-review of my own code +- [ ] My changes generate no new warnings +- [ ] I have commented my code, particularly in hard-to-understand areas + +# Any other information (e.g how to test the changes) + +None From 1dca1995f2b4a30828306f20f60defe31b4bde12 Mon Sep 17 00:00:00 2001 From: Luka Hietala <95122845+LukaHietala@users.noreply.github.com> Date: Sun, 5 Jun 2022 23:21:36 +0300 Subject: [PATCH 68/77] Fixed the link to the documentation repository. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 643ea4c..244c711 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,4 +106,4 @@ When making your PR, follow these guidelines: ### Improving The Documentation -All updates to the documentation should be made in a pull request to [this repo](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/) +All updates to the documentation should be made in a pull request to [this repo]([https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/](https://github.com/LukaHietala/reddit-bot-docs)) From ea328ba908b02a0e642550d133e701a8c8865b41 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sun, 5 Jun 2022 21:23:57 +0100 Subject: [PATCH 69/77] Make link work --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 244c711..e17be29 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,4 +106,4 @@ When making your PR, follow these guidelines: ### Improving The Documentation -All updates to the documentation should be made in a pull request to [this repo]([https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/](https://github.com/LukaHietala/reddit-bot-docs)) +All updates to the documentation should be made in a pull request to [this repo](https://github.com/LukaHietala/reddit-bot-docs) From 156c9884202e529a141f1c3a9075981be95b82d7 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sun, 5 Jun 2022 21:26:22 +0100 Subject: [PATCH 70/77] Fix PR Template --- .../pull_request_template.md | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md deleted file mode 100644 index 7fc8f80..0000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ /dev/null @@ -1,21 +0,0 @@ -# Description - - - -# Issue Fixes - - - -None - -# Checklist: - -- [ ] I am pushing to the **develop** branch -- [ ] I am using the recommended development environment -- [ ] I have performed a self-review of my own code -- [ ] My changes generate no new warnings -- [ ] I have commented my code, particularly in hard-to-understand areas - -# Any other information (e.g how to test the changes) - -None From 3693dce2cad58315b0a1462ee182207880cecfbc Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Sun, 5 Jun 2022 16:37:17 -0400 Subject: [PATCH 71/77] Update main.py --- main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main.py b/main.py index 6ebb0ea..61ccbbb 100644 --- a/main.py +++ b/main.py @@ -50,7 +50,6 @@ time.sleep(1) if not os.path.exists(".env"): - shutil.copy(".env.template", ".env") configured = False console.log("[red] Your .env file is invalid, or was never created. Standby.") From 72a4bdabaf898619f92db2d2a5beb3ce5369526f Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sun, 5 Jun 2022 22:27:04 +0100 Subject: [PATCH 72/77] Fix merge errors from other PR's --- .env.template | 6 +++--- main.py | 18 +++--------------- reddit/subreddit.py | 2 +- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/.env.template b/.env.template index 6b55f99..e95c209 100644 --- a/.env.template +++ b/.env.template @@ -4,11 +4,11 @@ REDDIT_CLIENT_SECRET="" REDDIT_USERNAME="" REDDIT_PASSWORD="" -# Valid options are "yes" and "no" +# Valid options are "yes" and "no" REDDIT_2FA="" -#If no, it will ask you a thread link to extract the thread, if yes it will randomize it. -RANDOM_THREAD="no" +#If no, it will ask you a thread link to extract the thread, if yes it will randomize it. +RANDOM_THREAD="yes" # Valid options are "light" and "dark" THEME="" diff --git a/main.py b/main.py index 61ccbbb..9aabe78 100644 --- a/main.py +++ b/main.py @@ -54,7 +54,7 @@ if not os.path.exists(".env"): console.log("[red] Your .env file is invalid, or was never created. Standby.") for val in REQUIRED_VALUES: - print(os.getenv(val)) + #print(os.getenv(val)) if val not in os.environ or not os.getenv(val): console.log(f'[bold red]Missing Variable: "{val}"') configured = False @@ -70,8 +70,8 @@ for val in REQUIRED_VALUES: console.log("[bold green]Here goes nothing! Launching setup wizard...") time.sleep(0.5) os.system("python3 setup.py") - else: - if setup_ask == "no": + + elif setup_ask == "no": console.print("[red]Exiting...") time.sleep(0.5) exit() @@ -79,8 +79,6 @@ for val in REQUIRED_VALUES: console.print("[red]I don't understand that. Exiting...") time.sleep(0.5) exit() - - exit() try: float(os.getenv("OPACITY")) except: @@ -91,16 +89,6 @@ except: exit() console.log("[bold green]Enviroment Variables are set! Continuing...") - -length, number_of_comments = save_text_to_mp3(reddit_object) -download_screenshots_of_reddit_posts( - reddit_object, number_of_comments, os.getenv("THEME") -) -download_background() -chop_background_video(length) -final_video = make_final_video(number_of_comments) - - if configured: reddit_object = get_subreddit_threads() length, number_of_comments = save_text_to_mp3(reddit_object) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 6d5fa7a..c560293 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -33,7 +33,7 @@ def get_subreddit_threads(): username=os.getenv("REDDIT_USERNAME"), password=passkey, ) - + # If the user specifies that he doesnt want a random thread, or if he doesn't insert the "RANDOM_THREAD" variable at all, ask the thread link if not os.getenv("RANDOM_THREAD") or os.getenv("RANDOM_THREAD") == "no": print_substep("Insert the full thread link:", style="bold green") From 7ff6739fee0b694437e6464c5f9f160254cad36d Mon Sep 17 00:00:00 2001 From: MeDBeD1 <82283979+MeDBeD1@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:29:00 +1000 Subject: [PATCH 73/77] Uploaded file with requested changes via DMs --- main.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/main.py b/main.py index 61ccbbb..0727e20 100644 --- a/main.py +++ b/main.py @@ -91,16 +91,6 @@ except: exit() console.log("[bold green]Enviroment Variables are set! Continuing...") - -length, number_of_comments = save_text_to_mp3(reddit_object) -download_screenshots_of_reddit_posts( - reddit_object, number_of_comments, os.getenv("THEME") -) -download_background() -chop_background_video(length) -final_video = make_final_video(number_of_comments) - - if configured: reddit_object = get_subreddit_threads() length, number_of_comments = save_text_to_mp3(reddit_object) From 1f56c896920171591f7a6b494f636980cb54a9be Mon Sep 17 00:00:00 2001 From: Freebie <69956546+FreebieII@users.noreply.github.com> Date: Mon, 6 Jun 2022 12:14:53 +0200 Subject: [PATCH 74/77] Grammar-ized contributing.md Fixed grammar and misinterpretations in `contributing.md`, i.e., Discord channel -> Discord Server --- CONTRIBUTING.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e17be29..ad3adb0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,9 +6,9 @@ All types of contributions are encouraged and valued. See the [Table of Contents > And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: > -> - Star the project -> - Tweet about it -> - Refer this project in your project's readme +> - ⭐ Star the project +> - πŸ“£ Tweet about it +> - 🌲 Refer this project in your project's readme ## Table of Contents @@ -33,7 +33,7 @@ If you then still feel the need to ask a question and need clarification, we rec We will then take care of the issue as soon as possible. -Additionally, there is a [discord channel](https://discord.gg/swqtb7AsNQ) for any questions you may have +Additionally, there is a [Discord Server](https://discord.gg/swqtb7AsNQ) for any questions you may have ## I Want To Contribute @@ -44,7 +44,7 @@ Additionally, there is a [discord channel](https://discord.gg/swqtb7AsNQ) for an A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. - Make sure that you are using the latest version. -- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/). If you are looking for support, you might want to check [this section](#i-have-a-question)). +- Determine if your bug is really a bug and not an error on your side e.g., using incompatible environment components/versions (Make sure that you have read the [documentation](https://luka-hietala.gitbook.io/documentation-for-the-reddit-bot/). If you are looking for support, you might want to check [this section](#i-have-a-question)). - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [issues](https://github.com/elebumm/RedditVideoMakerBot/). - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue - you probably aren't the first to get the error! - Collect information about the bug: @@ -100,7 +100,7 @@ You development environment should follow the requirements stated in the [README When making your PR, follow these guidelines: -- Your branch has a base of _develop_ **not** _master_ +- Your branch has a base of _develop_, **not** _master_ - You are merging your branch into the _develop_ branch - You link any issues that are resolved or fixed by your changes. (this is done by typing "Fixes #\") in your pull request. From cf094fa9ae6ba9162927c3e5ff2ea34e6482727a Mon Sep 17 00:00:00 2001 From: BlockArchitech Date: Mon, 6 Jun 2022 10:14:52 -0400 Subject: [PATCH 75/77] Create LICENSE --- LICENSE | 674 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 674 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b477f17 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. From beb1da81452c0ab2e91ece6bedf86842849fc6e3 Mon Sep 17 00:00:00 2001 From: Luka Hietala <95122845+LukaHietala@users.noreply.github.com> Date: Mon, 6 Jun 2022 18:25:22 +0300 Subject: [PATCH 76/77] Added developers section. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index df52b59..8828654 100644 --- a/README.md +++ b/README.md @@ -60,3 +60,11 @@ I have tried to simplify the code so anyone can read it and start contributing a - [ ] Creating better documentation and adding a command line interface. Please read our [contributing guidelines](CONTRIBUTING.md) for more detailed information. + +## Developers and maintainers. + +Elebumm (Lewis#6305) - https://github.com/elebumm (Founder) +CallumIO - https://github.com/CallumIO +HarryDaDev (hrvyy#9677) - https://github.com/ImmaHarry +LukaHietala (Pix.#0001) - https://github.com/LukaHietala +Freebiell - https://github.com/FreebieII From 4a0f753fa2f683f65e4c32b13701a7f7b5eb571c Mon Sep 17 00:00:00 2001 From: Luka Hietala <95122845+LukaHietala@users.noreply.github.com> Date: Mon, 6 Jun 2022 18:28:26 +0300 Subject: [PATCH 77/77] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8828654..56f4581 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,11 @@ Please read our [contributing guidelines](CONTRIBUTING.md) for more detailed inf ## Developers and maintainers. Elebumm (Lewis#6305) - https://github.com/elebumm (Founder) + CallumIO - https://github.com/CallumIO + HarryDaDev (hrvyy#9677) - https://github.com/ImmaHarry + LukaHietala (Pix.#0001) - https://github.com/LukaHietala + Freebiell - https://github.com/FreebieII