Add installer and wrapper
This commit is contained in:
parent
a6e161a143
commit
eecdc0e6ec
3 changed files with 58 additions and 2 deletions
12
README.md
12
README.md
|
@ -6,10 +6,18 @@
|
|||
|
||||
### Linux
|
||||
|
||||
```bash
|
||||
pip install .
|
||||
To install for example in your ~/.local/bin folder:
|
||||
```bash
|
||||
./install.sh --destination ~/.local/bin
|
||||
```
|
||||
|
||||
To install system-wide:
|
||||
```bash
|
||||
sudo ./install.sh --destination /usr/local/bin
|
||||
```
|
||||
|
||||
Change your configuration file in "${HOME}/.config/get_youtube_videos.conf" (see the example in the config folder).
|
||||
|
||||
### Windows (from PowerShell)
|
||||
|
||||
Ensure you have "C:\Users\${env:USERNAME}\AppData\Roaming\Python\Python${python_version}\Scripts\" in your Path environment variable.
|
||||
|
|
29
install.sh
Executable file
29
install.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
destination="/usr/local/bin"
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
"--help"|"-h"|"-?")
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
"--destination"|"-d")
|
||||
shift
|
||||
destination="${1}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Ignoring unknwon parameter '${1}'"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -x "${HOME}/.config/get_youtube_videos.conf" ]; then
|
||||
touch "${HOME}/.config/get_youtube_videos.conf"
|
||||
fi
|
||||
chmod go-rwx "${HOME}/.config/get_youtube_videos.conf"
|
||||
|
||||
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
sed "s#__src_folder__#${script_dir}#g" wrapper.sh > "${destination}/get_youtube_videos.sh"
|
||||
chmod +x "${destination}/get_youtube_videos.sh"
|
19
wrapper.sh
Normal file
19
wrapper.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
CONFIG_FILE="${HOME}/.config/get_youtube_videos.conf"
|
||||
cd "__src_folder__" || exit 1
|
||||
if [ -r "${CONFIG_FILE}" ]; then
|
||||
perms=$(stat -c %A "${CONFIG_FILE}")
|
||||
if [ "${perms:4:6}" != '------' ]; then
|
||||
echo "Permissions too open for config file '${CONFIG_FILE}' ($perms). Remove all permissions to group and others."
|
||||
exit 1
|
||||
fi
|
||||
config=(--config "${CONFIG_FILE}")
|
||||
else
|
||||
config=()
|
||||
fi
|
||||
"__src_folder__/get_youtube_videos.sh" "${config[@]}" "${@}"
|
||||
|
||||
download_dir="${HOME}/downloaded_youtube_videos"
|
||||
# shellcheck disable=SC1090
|
||||
source "${CONFIG_FILE}"
|
||||
chmod 0777 "${download_dir}" -R
|
Loading…
Reference in a new issue