diff --git a/config.sh b/config.sh index 8adfd61..44e54b9 100644 --- a/config.sh +++ b/config.sh @@ -6,4 +6,4 @@ YOUTUBE_DL="./yt-dlc/youtube-dlc" # Where the downloaded videos will get stored -SAVEDIR="./downloads" +OUTDIR="./downloads" diff --git a/southpark-downloader.sh b/southpark-downloader.sh index c513686..3241e85 100755 --- a/southpark-downloader.sh +++ b/southpark-downloader.sh @@ -2,9 +2,13 @@ source "$(dirname $0)/config.sh" -# 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" +[ ! -e "$(dirname $0)/$OUTDIR" ] && mkdir -p "$(dirname $0)/$OUTDIR" + +# Turn paths into absolute ones, if they aren't already, as we will change directories later +[ ! "${SAVEDIR::1}" = "/" ] && + OUTDIR="$(readlink -f $(dirname $0)/$OUTDIR)" +[ ! "${YOUTUBE_DL::1}" = "/" ] && + YOUTUBE_DL="$(readlink -f $(dirname $0)/$YOUTUBE_DL)" p_info() { echo -e "\e[32m>>> $@\e[m" @@ -160,8 +164,6 @@ download_all() { done } -[ ! -e "$OUTDIR" ] && mkdir -p "$OUTDIR" - if [ -n "$OPT_SEASON" ]; then get_season_url "$OPT_SEASON" [ -z "$RES" ] &&