From: Andrew Lorimer Date: Sat, 7 Jul 2018 10:09:08 +0000 (+1000) Subject: remove youtuve-archive.sh X-Git-Url: https://git.lorimer.id.au/scripts.git/diff_plain/7578b0c9b5b6418db517636312ef36226b968660?ds=inline;hp=-c remove youtuve-archive.sh --- 7578b0c9b5b6418db517636312ef36226b968660 diff --git a/youtube-archive.sh b/youtube-archive.sh deleted file mode 100644 index 7d6d3ba..0000000 --- a/youtube-archive.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -YOUTUBEDL='/usr/local/bin/youtube-dl' # Absolute path to youtube-dl executable -ARCHIVE='~/youtube_archive' # Absolute path to archive - -$YOUTUBEDL -U - -archive () { - mkdir -p "$ARCHIVE/$1" - cd "$ARCHIVE/$1" - rmdir -- * 2> /dev/null - rm -fv -- */*.part 2> /dev/null - rm -rf $(find . -printf '%h\n' | sort | uniq -c | while read -r n d ; do [ $n -lt 5 ] && printf '%s\n' "$d" ; done) 2> /dev/null - - $YOUTUBEDL -q --get-id https://youtube.com/$2 | while read VIDEOID; do - if [ -d "$ARCHIVE/$1/$VIDEOID" ]; then - echo -e "\\n\\n$VIDEOID already archived, skipping…\\n\\n" - else - echo -r "\\n\\nArchiving $VIDEOID.\\n\\n" - mkdir "$ARCHIVE/$1/$VIDEOID" - cd "$ARCHIVE/$1/$VIDEOID" - $YOUTUBEDL -o "%(upload_date)s.video" -- $VIDEOID - ls *.video | cut -c1-8 > date.txt - mv -v *.video video.mp4 - $YOUTUBEDL --get-title -- $VIDEOID > title.txt - $YOUTUBEDL --get-description -- $VIDEOID > description.txt - wget $($YOUTUBEDL --get-thumbnail -- $VIDEOID) - mv -v *.jpg thumbnail.jpg - fi - done -} - -# Enter channels here. For example: -# -# archive "Gronkh" Gronkh -# archive "SpiegelTV" channel/UC1w6pNGiiLdZgyNpXUnA4Zw