aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2018-07-16 23:22:52 -0300
committerEuAndreh <eu@euandre.org>2018-07-16 23:22:52 -0300
commitf630c32b1b3bef687446803bfb1aaff589d8123f (patch)
tree945ea4cc0270df7840155d5fd982ef9374473faa
parentConfig large-file-size for Emacs to 10MB (diff)
downloaddotfiles-f630c32b1b3bef687446803bfb1aaff589d8123f.tar.gz
dotfiles-f630c32b1b3bef687446803bfb1aaff589d8123f.tar.xz
Add inc_download function to youtube.sh
-rw-r--r--bash/youtube.sh26
-rwxr-xr-xencrypted/scripts/video-feed.shbin2473 -> 2485 bytes
2 files changed, 22 insertions, 4 deletions
diff --git a/bash/youtube.sh b/bash/youtube.sh
index 929d96d..da2d154 100644
--- a/bash/youtube.sh
+++ b/bash/youtube.sh
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
export DEFAULT_PLAYLIST_END=15
+export DEFAULT_INC_STEP=10
+
download() {
youtube-dl "$1" \
@@ -9,23 +11,39 @@ download() {
--playlist-end $2 \
--output "~/Downloads/yt-dl/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"
}
-
export -f download
+
download_user() {
download "https://www.youtube.com/user/$1" ${2-$DEFAULT_PLAYLIST_END}
}
-
export -f download_user
+
download_channel() {
download "https://www.youtube.com/channel/$1" ${2-$DEFAULT_PLAYLIST_END}
}
-
export -f download_channel
+
download_playlist() {
download "https://www.youtube.com/playlist?list=$1" ${2-$DEFAULT_PLAYLIST_END}
}
-
export -f download_playlist
+
+
+inc_download() {
+ local fn="$1"
+ local id="$2"
+ local step="${3-$DEFAULT_INC_STEP}"
+
+ local file="$HOME/.yt-db/$id"
+ local n_count="$(cat $file 2> /dev/null || printf 10)"
+ local n_count_new="$(($n_count + $step))"
+
+ echo "$n_count_new" > "$file"
+
+ "$fn" "$id" "$n_count"
+}
+
+export -f inc_download
diff --git a/encrypted/scripts/video-feed.sh b/encrypted/scripts/video-feed.sh
index 3d0e416..c0cc940 100755
--- a/encrypted/scripts/video-feed.sh
+++ b/encrypted/scripts/video-feed.sh
Binary files differ