diff options
author | EuAndreh <eu@euandre.org> | 2018-07-16 23:22:52 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2018-07-16 23:22:52 -0300 |
commit | f630c32b1b3bef687446803bfb1aaff589d8123f (patch) | |
tree | 945ea4cc0270df7840155d5fd982ef9374473faa | |
parent | Config large-file-size for Emacs to 10MB (diff) | |
download | dotfiles-f630c32b1b3bef687446803bfb1aaff589d8123f.tar.gz dotfiles-f630c32b1b3bef687446803bfb1aaff589d8123f.tar.xz |
Add inc_download function to youtube.sh
-rw-r--r-- | bash/youtube.sh | 26 | ||||
-rwxr-xr-x | encrypted/scripts/video-feed.sh | bin | 2473 -> 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 Binary files differindex 3d0e416..c0cc940 100755 --- a/encrypted/scripts/video-feed.sh +++ b/encrypted/scripts/video-feed.sh |