ripper/installer

34 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2021-01-03 19:21:47 +01:00
#!/bin/sh
2021-01-03 19:24:58 +01:00
DESTDIR="$HOME/.local/bin"
2021-01-03 19:21:47 +01:00
XDG_VIDEOS_DIR=$HOME/vids #TODO ADJUST FOR PERSONAL USE HERE!
DLARCHIVE="${XDG_VIDEOS_DIR:-$HOME/Videos}/.downloaded"
DLLOC="${XDG_VIDEOS_DIR:-$HOME/Videos}"
CHANNELSFILE="${XDG_VIDEOS_DIR:-$HOME/Videos}/.channels"
BLACKLIST="${XDG_VIDEOS_DIR:-$HOME/Videos}/.blacklist"
install(){
mkdir -p "$DLLOC" "$(dirname "$CHANNELSFILE")" "$(dirname "$DLARCHIVE")" "$(dirname "$BLACKLIST")" "$DESTDIR"
2021-01-03 19:24:58 +01:00
cp -f ripper "$DESTDIR/ripper"
[ -f "$CHANNELSFILE" ] || printf '#Add channels in this file\n#Format: https://www.youtube.com/channel/<channelId>' > "$CHANNELSFILE"
[ -f "$BLACKLIST" ] || printf '#Add video URIs here (not just the IDs)' > "$BLACKLIST"
[ -f "$DLARCHIVE" ] || printf '#These videos will not be attempted to download again' > "$DLARCHIVE"
2021-01-03 19:21:47 +01:00
}
uninstall(){
rm "$DESTDIR/ripper"
}
clean(){
rm "$BLACKLIST" "$DLARCHIVE" "$CHANNELSFILE"
}
case "$1" in
"install") install;;
"uninstall") uninstall;;
"clean") clean;;
*) echo "installer [install] [uninstall] [clean]
install: installs application and adds needed files if not present
uninstall: remove application
clean: remove channels, archive, and blacklist files (use with caution!)";;
esac