aboutsummaryrefslogtreecommitdiff
path: root/bash/youtube.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bash/youtube.sh')
-rw-r--r--bash/youtube.sh9
1 files changed, 8 insertions, 1 deletions
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))"