Use paths relative to executable + other stuff

This commit is contained in:
xypwn 2020-12-13 12:32:38 +01:00
parent 9f5aa68505
commit 8be86e51f2
3 changed files with 9 additions and 8 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
downloads/*
downloads/
yt-dlc/

View File

@ -4,10 +4,10 @@ Effortlessly download South Park episodes from southpark.de in bulk
## Setup
`git clone https://github.com/xypwn/southpark-de-downloader.git; cd southpark-de-downloader`
`sh init.sh` this will download youtube-dlc and apply a patch for english episodes.
`./init.sh` this will download youtube-dlc and apply a patch for english episodes.
## Usage
`sh southpark-downloader.sh -h` to show usage instructions
`./southpark-downloader.sh -h` to show usage instructions
All downloads will end up in the `downloads` folder in the cloned repo (you can also change it in config.sh, if you want to).
@ -16,4 +16,4 @@ All downloads will end up in the `downloads` folder in the cloned repo (you can
`./southpark-downloader.sh -s 5 -e 13` download Season 5 Episode 13
`./southpark-downloader.sh -D -s 1` download Season 2 in German
`./southpark-downloader.sh -D -s 2` download Season 2 in German

View File

@ -1,9 +1,10 @@
#!/usr/bin/env sh
source ./config.sh
source "$(dirname $0)/config.sh"
YOUTUBE_DL="$PWD/$YOUTUBE_DL"
OUTDIR="$PWD/$SAVEDIR"
# We need absolute paths, since we'll be changing directories later
YOUTUBE_DL="$(readlink -f $(dirname $0))/$YOUTUBE_DL"
OUTDIR="$(readlink -f $(dirname $0))/$SAVEDIR"
p_info() {
echo -e "\e[32m>>> $@\e[m"
@ -159,7 +160,7 @@ download_all() {
done
}
[ ! -e "$OUTDIR" ] && mkdir "$OUTDIR"
[ ! -e "$OUTDIR" ] && mkdir -p "$OUTDIR"
if [ -n "$OPT_SEASON" ]; then
get_season_url "$OPT_SEASON"