From 02fb74e32b3b1b58c2ba72afa730129b42228936 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Fri, 25 Dec 2020 21:54:03 +0100 Subject: [PATCH] fixed broken pipe error, only print notifs if its not wasting time --- .local/bin/tools/ripper | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.local/bin/tools/ripper b/.local/bin/tools/ripper index b80a842..69487fd 100755 --- a/.local/bin/tools/ripper +++ b/.local/bin/tools/ripper @@ -20,13 +20,14 @@ grep 'bitchute' "$CHANNELSFILE" | xargs -L1 lynx --dump --nonumbers -listonly $1 grep 'bitchute' "$DLARCHIVE" | sed 's/bitchute /https:\/\/www\.bitchute\.com\/video\//' >> /tmp/alreadydownloaded number=$(grep -vf /tmp/alreadydownloaded /tmp/todownload | grep -vf $BLACKLIST | sort -u | wc -l) -grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u if [ $number -gt 0 ]; then [ $number -eq 1 ] && ( notify-send "Channel Ripper" "1 new video available for download, downloading now." ) || ( notify-send "Channel Ripper" "$number new videos available for download, downloading now." ) echo "$number new videos for download available, downloading now." - grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | xargs -L1 youtube-dl --get-filename -o "'%(uploader)s' '%(title)s'" $1 | xargs -L1 notify-send - grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | grep 'youtube' | xargs -r -L1 youtube-dl --hls-prefer-native -i --download-archive $DLARCHIVE --dateafter $range -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' --add-metadata -o "$DLLOC/%(uploader)s/%(upload_date)s-%(title)s.%(ext)s" - grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | grep 'bitchute' | xargs -r -L1 youtube-dl --hls-prefer-native -i --download-archive $DLARCHIVE -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' --add-metadata -o "$DLLOC/%(uploader)s/%(upload_date)s-%(title)s.%(ext)s" + if [ "$number" -lt 10 ];then + grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | xargs -L1 youtube-dl --get-filename -o "'%(uploader)s' '%(title)s'" $1 | xargs -L1 notify-send + fi + grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | grep 'youtube' | xargs -r -L1 -0 youtube-dl --hls-prefer-native -i --download-archive $DLARCHIVE --dateafter $range -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' --add-metadata -o "$DLLOC/%(uploader)s/%(upload_date)s-%(title)s.%(ext)s" + grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | grep 'bitchute' | xargs -r -L1 -0 youtube-dl --hls-prefer-native -i --download-archive $DLARCHIVE -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' --add-metadata -o "$DLLOC/%(uploader)s/%(upload_date)s-%(title)s.%(ext)s" notify-send "Channel Ripper" "Finished downloading" fi