From 019c8308f440dc940211124b1168969110c8dca3 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Fri, 27 Jan 2023 11:45:14 +0400 Subject: [PATCH] Stats (downloaded and errored) --- autoytdlp.sh | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/autoytdlp.sh b/autoytdlp.sh index f12636f..6be8b44 100755 --- a/autoytdlp.sh +++ b/autoytdlp.sh @@ -3,6 +3,8 @@ debug=0 watching=1 links=() +success=0 +error=0 # ------- # Helpers @@ -113,7 +115,15 @@ dlwith_piped () { fi echo "Downloading with wget" - wget -O "$video_file" "$stream_url" + + if wget -O "$video_file" "$stream_url" + then + bold "OK" + success=$(( success + 1 )) + else + bold "Error" + error=$(( error + 1 )) + fi echo done @@ -160,7 +170,15 @@ dlwith_ytdlp () { fi echo "Downloading with yt-dlp" - yt-dlp -f "$format" -o "$video_file" -P ./files/ "$newlink" + + if yt-dlp -f "$format" -o "$video_file" -P ./files/ "$newlink" + then + bold "OK" + success=$(( success + 1 )) + else + bold "Error" + error=$(( error + 1 )) + fi echo done @@ -234,6 +252,11 @@ main() { dlwith_ytdlp fi + # Show result + bold "Downloaded: $success" + bold "Errors: $error" + echo + # Waiting for the response echo 'Press Ctrl+C to exit' while true; do :; done