From fd80b8833dded94aa74cedf5f09cb281d3a9bcb3 Mon Sep 17 00:00:00 2001 From: micziz Date: Tue, 5 Jul 2022 12:29:02 +0200 Subject: [PATCH 01/11] THis shloud work! --- install.sh | 220 +++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 1 + 2 files changed, 221 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..6453dc0 --- /dev/null +++ b/install.sh @@ -0,0 +1,220 @@ +#!/bin/bash + +# If the install fails, then print an error and exit. +function install_fail() { + echo "Installation failed" + exit 1 +} + +# This is the help fuction. It helps users withe the options +function Help(){ + echo "Usage: install.sh [option]" + echo "Options:" + echo " -h: Show this help message and exit" + echo " -d: Install only dependencies" + echo " -p: Install only python dependencies (including playwright)" + echo " -b: Install just the bot" + echo " -l: Install the bot and the python dependencies" +} + +# Options +while getopts ":hydpbl" option; do + case $option in + # -h, prints help message + h) + Help exit 0;; + # -y, assumes yes + y) + ASSUME_YES=1;; + # -d install only dependencies + d) + DEPS_ONLY=1;; + # -p install only python dependencies + p) + PYTHON_ONLY=1;; + b) + JUST_BOT=1;; + l) + BOT_AND_PYTHON=1;; + # if a bad argument is given, then throw an error + \?) + echo "Invalid option: -$OPTARG" >&2 Help exit 1;; + :) + echo "Option -$OPTARG requires an argument." >&2 Help exit 1;; + esac +done + +# Install dependencies for MacOS +function install_macos(){ + # Check if homebrew is installed + if [ ! command -v brew &> /dev/null ]; then + echo "Installing Homebrew" + # if it's is not installed, then install it in a NONINTERACTIVE way + NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" + # Check for what arcitecture, so you can place path. + if [[ "uname -m" == "x86_64" ]]; then + echo "export PATH=/usr/local/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile + fi + # If not + else + # Print that it's already installed + echo "Homebrew is already installed" + fi + # Install the required packages + echo "Installing required Packages" + brew install python@3.10 tcl-tk python-tk +} + +# Function to install for arch (and other forks like manjaro) +function install_arch(){ + echo "Installing required packages" + sudo pacman -S --needed python3 tk git && python3 -m ensurepip || install_fail +} + +# Function to install for debian (and ubuntu) +function install_deb(){ + echo "Installing required packages" + sudo apt install python3 python3-dev python3-tk python3-pip git || install_fail +} + +# Function to install for fedora (and other forks) +function install_fedora(){ + echo "Installing required packages" + sudo dnf install python3 python3-tkinter python3-pip git python3-devel || install_fail +} + +# Function to install for centos (and other forks based on it) +function install_centos(){ + echo "Installing required packages" + sudo yum install -y python3 || install_fail + sudo yum install -y python3-tkinter epel-release python3-pip git || install_fail +} + +function get_the_bot(){ + echo "Downloading the bot" + git clone https://github.com/elebumm/RedditVideoMakerBot.git +} + +#install python dependencies +function install_python_dep(){ + # tell the user that the script is going to install the python dependencies + echo "Installing python dependencies" + # cd into the directory + cd RedditVideoMakerBot + # install the dependencies + pip3 install -r requirements.txt + # cd out + cd .. +} + +# install playwright function +function install_playwright(){ + # tell the user that the script is going to install playwright + echo "Installing playwright" + # cd into the directory where the script is downloaded + cd RedditVideoMakerBot + # run the install script + playwright install + playwright install-deps + # give a note + printf "Note, if these gave any errors, please run this command This will (maybe) fix the issue with playwright.\npython -m playwright install && python -m playwright install-deps" + cd .. +} + +# Install depndencies +function install_deps(){ + # if the platform is mac, install macos + if [ "$(uname)" == "Darwin" ]; then + install_macos || install_fail + # if pacman is found + elif [ -x "$(command -v pacman)" ]; then + # install for arch + install_arch || install_fail + # if apt-get is found + elif [ -x "$(command -v apt-get)" ]; then + # install fro debian + install_deb || install_fail + # if dnf is found + elif [ -x "$(command -v dnf)" ]; then + # install for fedora + install_fedora || install_fail + # if yum is found + elif [ -x "$(command -v yum)" ]; then + # install for centos + install_centos || install_fail + # else + else + # print an error message and exit + printf "Your OS is not supported\n Please install python3, pip3 and git manually\n After that, run the script again with the -pb option to install python and playwright dependencies\n If you want to add support for your OS, please open a pull request on github\n +https://github.com/elebumm/RedditVideoMakerBot" + exit 1 + fi +} + +# Main function +function install_main(){ + # Print that are installing + echo "Installing..." + # if -y (assume yes) continue + if [[ ASSUME_YES -eq 1 ]]; then + echo "Assuming yes" + # else, ask if they want to continue + else + echo "Continue? (y/n)" + read answer + # if the answer is not yes, then exit + if [ "$answer" != "y" ]; then + echo "Aborting" + exit 1 + fi + fi + # if the -d (only dependencies) options is selected install just the dependencies + if [[ DEPS_ONLY -eq 1 ]]; then + echo "Installing only dependencies" + install_deps + elif [[ PYTHON_ONLY -eq 1 ]]; then + # if the -p (only python dependencies) options is selected install just the python dependencies and playwright + echo "Installing only python dependencies" + install_python_dep + install_playwright + # if the -b (only the bot) options is selected install just the bot + elif [[ JUST_BOT -eq 1 ]]; then + echo "Installing only the bot" + get_the_bot + # if the -l (bot and python) options is selected install just the bot and python dependencies + elif [[ BOT_AND_PYTHON -eq 1 ]]; then + echo "Installing only the bot and python dependencies" + get_the_bot + install_python_dep + # else, install everything + else + echo "Installing all" + install_deps + get_the_bot + install_python_dep + install_playwright + fi + + DIR="./RedditVideoMakerBot" + if [ -d "$DIR" ]; then + printf "\nThe bot is already installed, want to run it?" + # if -y (assume yes) continue + if [[ ASSUME_YES -eq 1 ]]; then + echo "Assuming yes" + # else, ask if they want to continue + else + echo "Continue? (y/n)" + read answer + # if the answer is not yes, then exit + if [ "$answer" != "y" ]; then + echo "Aborting" + exit 1 + fi + fi + cd RedditVideoMakerBot + python3 main.py + fi +} + +# Run the main function +install_main \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 687f952..22b53b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ pytube==12.1.0 requests==2.28.1 rich==12.4.4 translators==5.3.1 +sox==1.4.1 From 74387ef8738dc877fe3b586276151027793b0004 Mon Sep 17 00:00:00 2001 From: micziz Date: Tue, 5 Jul 2022 12:36:45 +0200 Subject: [PATCH 02/11] Modify readme --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index dc6237c..dffef91 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,12 @@ The only original thing being done is the editing and gathering of all materials 3. Run `playwright install` and `playwright install-deps`. (if this fails try adding python -m to the front of the command) +**EXPERIMENTAL!!!!** + +On MacOS and Linux (debian, arch, fedora and centos, and based on those), you can run an install script that will automatically install steps 1 to 3. (requires bash) + +`bash <(curl -sL https://raw.githubusercontent.com/micziz/RedditVideoMakerBot/master/install.sh)` + 4. Run `python main.py` required\*\*), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". 5. Enjoy 😎 From c3544bf64e621289a40f09604feba96e4eff3775 Mon Sep 17 00:00:00 2001 From: micziz Date: Tue, 5 Jul 2022 12:44:09 +0200 Subject: [PATCH 03/11] Final fix in readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index dffef91..dad8f59 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ On MacOS and Linux (debian, arch, fedora and centos, and based on those), you ca `bash <(curl -sL https://raw.githubusercontent.com/micziz/RedditVideoMakerBot/master/install.sh)` +This can also be used to update the installation + 4. Run `python main.py` required\*\*), visit [the Reddit Apps page.](https://www.reddit.com/prefs/apps) TL;DR set up an app that is a "script". 5. Enjoy 😎 From 8b082f0cc6a1eb9b5321437aab7165d71002d1d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Jul 2022 10:58:41 +0000 Subject: [PATCH 04/11] Bump boto3 from 1.24.12 to 1.24.23 Bumps [boto3](https://github.com/boto/boto3) from 1.24.12 to 1.24.23. - [Release notes](https://github.com/boto/boto3/releases) - [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst) - [Commits](https://github.com/boto/boto3/compare/1.24.12...1.24.23) --- updated-dependencies: - dependency-name: boto3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 687f952..2e54596 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -boto3==1.24.12 +boto3==1.24.23 botocore==1.27.22 gTTS==2.2.4 moviepy==1.0.3 From 4a8a3e0b7232dac5dcfe08e0659f3d796af52200 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Jul 2022 16:38:45 +0000 Subject: [PATCH 05/11] Bump botocore from 1.27.22 to 1.27.23 Bumps [botocore](https://github.com/boto/botocore) from 1.27.22 to 1.27.23. - [Release notes](https://github.com/boto/botocore/releases) - [Changelog](https://github.com/boto/botocore/blob/develop/CHANGELOG.rst) - [Commits](https://github.com/boto/botocore/compare/1.27.22...1.27.23) --- updated-dependencies: - dependency-name: botocore dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2e54596..38df393 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ boto3==1.24.23 -botocore==1.27.22 +botocore==1.27.23 gTTS==2.2.4 moviepy==1.0.3 mutagen==1.45.1 From 5455b7ef25f26bcd9ccdf116d4e6573917306294 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Jul 2022 10:47:20 +0000 Subject: [PATCH 06/11] Bump boto3 from 1.24.23 to 1.24.24 Bumps [boto3](https://github.com/boto/boto3) from 1.24.23 to 1.24.24. - [Release notes](https://github.com/boto/boto3/releases) - [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst) - [Commits](https://github.com/boto/boto3/compare/1.24.23...1.24.24) --- updated-dependencies: - dependency-name: boto3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 38df393..85d3d47 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -boto3==1.24.23 +boto3==1.24.24 botocore==1.27.23 gTTS==2.2.4 moviepy==1.0.3 From 303efb8052650a251717eddcbe386b3622084ca2 Mon Sep 17 00:00:00 2001 From: micziz <99438936+micziz@users.noreply.github.com> Date: Thu, 7 Jul 2022 13:20:41 +0200 Subject: [PATCH 07/11] Update requirements.txt --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index cc99eda..38df393 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,3 @@ pytube==12.1.0 requests==2.28.1 rich==12.4.4 translators==5.3.1 -sox==1.4.1 From bd529add7d963f2caf5bdcf45ace9b7425f54fa6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Jul 2022 17:28:13 +0000 Subject: [PATCH 08/11] Bump botocore from 1.27.23 to 1.27.24 Bumps [botocore](https://github.com/boto/botocore) from 1.27.23 to 1.27.24. - [Release notes](https://github.com/boto/botocore/releases) - [Changelog](https://github.com/boto/botocore/blob/develop/CHANGELOG.rst) - [Commits](https://github.com/boto/botocore/compare/1.27.23...1.27.24) --- updated-dependencies: - dependency-name: botocore dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 85d3d47..40c7632 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ boto3==1.24.24 -botocore==1.27.23 +botocore==1.27.24 gTTS==2.2.4 moviepy==1.0.3 mutagen==1.45.1 From 6c17f5486aa6054278dbee01fc3eff9017af852d Mon Sep 17 00:00:00 2001 From: micziz <99438936+micziz@users.noreply.github.com> Date: Fri, 8 Jul 2022 21:58:13 +0200 Subject: [PATCH 09/11] Fix repo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dad8f59..c0e7095 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ The only original thing being done is the editing and gathering of all materials On MacOS and Linux (debian, arch, fedora and centos, and based on those), you can run an install script that will automatically install steps 1 to 3. (requires bash) -`bash <(curl -sL https://raw.githubusercontent.com/micziz/RedditVideoMakerBot/master/install.sh)` +`bash <(curl -sL https://raw.githubusercontent.com/elebumm/RedditVideoMakerBot/master/install.sh)` This can also be used to update the installation From 259c17a38cb36787090f5a998c5e49f16004d644 Mon Sep 17 00:00:00 2001 From: micziz <99438936+micziz@users.noreply.github.com> Date: Fri, 8 Jul 2022 22:01:41 +0200 Subject: [PATCH 10/11] Fix playwright --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 6453dc0..7f24870 100644 --- a/install.sh +++ b/install.sh @@ -114,8 +114,8 @@ function install_playwright(){ # cd into the directory where the script is downloaded cd RedditVideoMakerBot # run the install script - playwright install - playwright install-deps + python3 -m playwright install + python3 -m playwright install-deps # give a note printf "Note, if these gave any errors, please run this command This will (maybe) fix the issue with playwright.\npython -m playwright install && python -m playwright install-deps" cd .. @@ -217,4 +217,4 @@ function install_main(){ } # Run the main function -install_main \ No newline at end of file +install_main From de36ba79e98978f751a8020f27fdd536ac80234e Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 9 Jul 2022 09:32:01 +0000 Subject: [PATCH 11/11] fix: add hints for playwright on arch --- install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 7f24870..4eae0ae 100644 --- a/install.sh +++ b/install.sh @@ -117,7 +117,9 @@ function install_playwright(){ python3 -m playwright install python3 -m playwright install-deps # give a note - printf "Note, if these gave any errors, please run this command This will (maybe) fix the issue with playwright.\npython -m playwright install && python -m playwright install-deps" + printfNote, if these gave any errors, playwright may not be officially supported on your OS, check this issues page for support\nhttps://github.com/microsoft/playwright/issues "Note, if these gave any errors, playwright may not be officially supported on your OS, check this issues page for support\nhttps://github.com/microsoft/playwright/issues\n" + if [ -x "$(command -v pacman)" ]; then + printf "It seems you are on and Arch based distro.\nTry installing these from the AUR for playwright to run:\nenchant1.6\nicu66\nlibwebp052\n" cd .. }