merged develop

pull/963/head
Drugsosos 2 years ago
commit da8d33c4e3
No known key found for this signature in database
GPG Key ID: 8E35176FE617E28D

@ -68,31 +68,34 @@ function install_macos(){
# Function to install for arch (and other forks like manjaro) # Function to install for arch (and other forks like manjaro)
function install_arch(){ function install_arch(){
echo "Installing required packages" echo "Installing required packages"
sudo pacman -S --needed python3 tk git && python3 -m ensurepip || install_fail sudo pacman -S --needed python3 tk git && python3 -m ensurepip unzip || install_fail
} }
# Function to install for debian (and ubuntu) # Function to install for debian (and ubuntu)
function install_deb(){ function install_deb(){
echo "Installing required packages" echo "Installing required packages"
sudo apt install python3 python3-dev python3-tk python3-pip git || install_fail sudo apt install python3 python3-dev python3-tk python3-pip unzip || install_fail
} }
# Function to install for fedora (and other forks) # Function to install for fedora (and other forks)
function install_fedora(){ function install_fedora(){
echo "Installing required packages" echo "Installing required packages"
sudo dnf install python3 python3-tkinter python3-pip git python3-devel || install_fail sudo dnf install python3 python3-tkinter python3-pip python3-devel unzip || install_fail
} }
# Function to install for centos (and other forks based on it) # Function to install for centos (and other forks based on it)
function install_centos(){ function install_centos(){
echo "Installing required packages" echo "Installing required packages"
sudo yum install -y python3 || install_fail sudo yum install -y python3 || install_fail
sudo yum install -y python3-tkinter epel-release python3-pip git || install_fail sudo yum install -y python3-tkinter epel-release python3-pip unzip|| install_fail
} }
function get_the_bot(){ function get_the_bot(){
echo "Downloading the bot" echo "Downloading the bot"
git clone https://github.com/elebumm/RedditVideoMakerBot.git rm -rf RedditVideoMakerBot-master
curl -sL https://github.com/elebumm/RedditVideoMakerBot/archive/refs/heads/master.zip -o master.zip
unzip master.zip
rm -rf master.zip
} }
#install python dependencies #install python dependencies
@ -100,7 +103,7 @@ function install_python_dep(){
# tell the user that the script is going to install the python dependencies # tell the user that the script is going to install the python dependencies
echo "Installing python dependencies" echo "Installing python dependencies"
# cd into the directory # cd into the directory
cd RedditVideoMakerBot cd RedditVideoMakerBot-master
# install the dependencies # install the dependencies
pip3 install -r requirements.txt pip3 install -r requirements.txt
# cd out # cd out
@ -112,7 +115,7 @@ function install_playwright(){
# tell the user that the script is going to install playwright # tell the user that the script is going to install playwright
echo "Installing playwright" echo "Installing playwright"
# cd into the directory where the script is downloaded # cd into the directory where the script is downloaded
cd RedditVideoMakerBot cd RedditVideoMakerBot-master
# run the install script # run the install script
python3 -m playwright install python3 -m playwright install
python3 -m playwright install-deps python3 -m playwright install-deps
@ -198,9 +201,9 @@ function install_main(){
install_playwright install_playwright
fi fi
DIR="./RedditVideoMakerBot" DIR="./RedditVideoMakerBot-master"
if [ -d "$DIR" ]; then if [ -d "$DIR" ]; then
printf "\nThe bot is already installed, want to run it?" printf "\nThe bot is installed, want to run it?"
# if -y (assume yes) continue # if -y (assume yes) continue
if [[ ASSUME_YES -eq 1 ]]; then if [[ ASSUME_YES -eq 1 ]]; then
echo "Assuming yes" echo "Assuming yes"
@ -214,7 +217,7 @@ function install_main(){
exit 1 exit 1
fi fi
fi fi
cd RedditVideoMakerBot cd RedditVideoMakerBot-master
python3 main.py python3 main.py
fi fi
} }

@ -27,6 +27,7 @@ theme = { optional = false, default = "dark", example = "light", options = ["dar
], explanation = "sets the Reddit theme, either LIGHT or DARK" } ], explanation = "sets the Reddit theme, either LIGHT or DARK" }
times_to_run = { optional = false, default = 1, example = 2, explanation = "used if you want to run multiple times. set to an int e.g. 4 or 29 or 1", type = "int", nmin = 1, oob_error = "It's very hard to run something less than once." } times_to_run = { optional = false, default = 1, example = 2, explanation = "used if you want to run multiple times. set to an int e.g. 4 or 29 or 1", type = "int", nmin = 1, oob_error = "It's very hard to run something less than once." }
opacity = { optional = false, default = 0.9, example = 0.8, explanation = "Sets the opacity of the comments when overlayed over the background", type = "float", nmin = 0, nmax = 1, oob_error = "The opacity HAS to be between 0 and 1", input_error = "The opacity HAS to be a decimal number between 0 and 1" } opacity = { optional = false, default = 0.9, example = 0.8, explanation = "Sets the opacity of the comments when overlayed over the background", type = "float", nmin = 0, nmax = 1, oob_error = "The opacity HAS to be between 0 and 1", input_error = "The opacity HAS to be a decimal number between 0 and 1" }
transition = { optional = true, default = 0.2, example = 0.2, explanation = "Sets the transition time (in seconds) between the comments. Set to 0 if you want to disable it.", type = "float", nmin = 0, nmax = 2, oob_error = "The transition HAS to be between 0 and 2", input_error = "The opacity HAS to be a decimal number between 0 and 2" }
storymode = { optional = true, type = "bool", default = false, example = false, options = [true, storymode = { optional = true, type = "bool", default = false, example = false, options = [true,
false, false,
], explanation = "not yet implemented" } ], explanation = "not yet implemented" }

@ -46,6 +46,8 @@ class FinalVideo:
self.opacity = settings.config["settings"]["opacity"] self.opacity = settings.config["settings"]["opacity"]
self.opacity = 1 if self.opacity is None or self.opacity >= 1 else self.opacity self.opacity = 1 if self.opacity is None or self.opacity >= 1 else self.opacity
self.transition = settings.config["settings"]["transition"]
self.transition = 0 if self.transition is None or self.transition > 2 else self.transition
@staticmethod @staticmethod
def name_normalize( def name_normalize(
@ -94,6 +96,8 @@ class FinalVideo:
width=self.W - self.W / 20 if self.vertical_video else None, width=self.W - self.W / 20 if self.vertical_video else None,
height=self.H - self.H / 5 if not self.vertical_video else None, height=self.H - self.H / 5 if not self.vertical_video else None,
) )
.crossfadein(self.transition)
.crossfadeout(self.transition)
) )
def make( def make(
@ -102,15 +106,20 @@ class FinalVideo:
reddit_obj: dict, reddit_obj: dict,
background_config: Tuple[str, str, str, Any], background_config: Tuple[str, str, str, Any],
) -> None: ) -> None:
""" """Gathers audio clips, gathers all screenshots, stitches them together and saves the final video to assets/temp
Gathers audio clips, gathers all screenshots, stitches them together and saves the final video to assets/temp
Args: Args:
indexes_of_clips (list): Indexes of voiced comments indexes_of_clips (list): Indexes of voiced comments
reddit_obj (dict): The reddit object that contains the posts to read. reddit_obj (dict): The reddit object that contains the posts to read.
background_config (Tuple[str, str, str, Any]): The background config to use. background_config (Tuple[str, str, str, Any]): The background config to use.
""" """
# try: # if it isn't found (i.e you just updated and copied over config.toml) it will throw an error
# VOLUME_MULTIPLIER = settings.config["settings"]['background']["background_audio_volume"]
# except (TypeError, KeyError):
# print('No background audio volume found in config.toml. Using default value of 1.')
# VOLUME_MULTIPLIER = 1
print_step("Creating the final video 🎥") print_step("Creating the final video 🎥")
VideoFileClip.reW = lambda clip: clip.resize(width=self.W)
VideoFileClip.reH = lambda clip: clip.resize(width=self.H)
# Gather all audio clips # Gather all audio clips
audio_clips = list() audio_clips = list()

Loading…
Cancel
Save