diff options
-rw-r--r-- | bash/aliases.sh | 1 | ||||
-rw-r--r-- | bash/env.sh | 1 | ||||
-rw-r--r-- | bash/youtube.sh | 9 |
3 files changed, 8 insertions, 3 deletions
diff --git a/bash/aliases.sh b/bash/aliases.sh index b9a9218..772cded 100644 --- a/bash/aliases.sh +++ b/bash/aliases.sh @@ -6,7 +6,6 @@ alias open="xdg-open" alias ros="rlwrap ros -l ~/.sbclrc" alias l="ls -lahp" alias ll="ls -lhp" -alias yt-dl="youtube-dl -o '$YT_TEMPLATE'" isLinux && { alias copy="tr -d '\n' | xclip -sel clip" } diff --git a/bash/env.sh b/bash/env.sh index c81cba2..a2e4785 100644 --- a/bash/env.sh +++ b/bash/env.sh @@ -32,7 +32,6 @@ export PATH=~/.local/bin:$PATH export EDITOR=vi export PATH="$DOTFILES/scripts/:$PATH" export PATH="$DOTFILES/encrypted/scripts/:$PATH" -export YT_TEMPLATE="~/Downloads/yt-dl/%(uploader)s/%(upload_date)s %(title)s.%(ext)s" export INPUTRC=~/.inputrc export CACHE_DIR="~/Nextcloud/cache" diff --git a/bash/youtube.sh b/bash/youtube.sh index c732e26..3c5b56e 100644 --- a/bash/youtube.sh +++ b/bash/youtube.sh @@ -2,14 +2,20 @@ export DEFAULT_PLAYLIST_END=15 export DEFAULT_INC_STEP=10 +export YT_TEMPLATE="~/Downloads/yt-dl/%(uploader)s/%(upload_date)s %(title)s.%(ext)s" +# Always downloads video, doesn't look at the download-archive +yt-dl() { + youtube-dl "$1" -o "$YT_TEMPLATE" +} +export -f yt-dl download() { youtube-dl "$1" \ --download-archive ~/Nextcloud/cache/youtube-dl-seen.conf \ --prefer-free-formats \ --playlist-end $2 \ - --output "~/Downloads/yt-dl/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s" + --output "$YT_TEMPLATE" } export -f download @@ -38,6 +44,7 @@ inc_download() { local step="${3-$DEFAULT_INC_STEP}" local file="$HOME/.yt-db/$id" + mkdir -p "$HOME/.yt-db" local n_count="$(cat $file 2> /dev/null || printf 10)" local n_count_new="$(($n_count + $step))" |