From 300422f1a434093e05ae697b346196ffcea54641 Mon Sep 17 00:00:00 2001 From: Salt Date: Sun, 28 Jul 2019 17:50:23 -0500 Subject: [PATCH] ptgdp: Revise logging a bit more, add statistics at end of dry run --- ptgdp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ptgdp b/ptgdp index ffb22cc..dd10cdb 100755 --- a/ptgdp +++ b/ptgdp @@ -139,7 +139,7 @@ playlist() { log "Made symlink to music directory" touch "$_musicdir/.symlink" else - log "Failed to make symlink to music directory" + error "Failed to make symlink to music directory" log "Music can be found at \"$_musicdir\"" fi fi @@ -193,6 +193,7 @@ playlist() { exitcode="$?" if [ $exitcode -gt 0 ]; then error "Could not find song \"$line\"" + dlerror+=1 continue fi if ! [ "$output" = "${output#*WARNING}" ]; then @@ -200,13 +201,14 @@ playlist() { else log "$line - \"$output\"" fi + dlsuccess+=1 fi done < <(if [ -n "$_optshuffle" ]; then shuf "$1"; else cat "$1"; fi) - if [ "$dlexist" = "0" ] && [ "$dlsuccess" = "0" ]; then + if [ "$dlexist" = "0" ] && [ "$dlsuccess" = "0" ] && [ -z "$_optdryrun" ]; then notify "Failed to enqueue playlist" \ "The playlist could not be enqueued. Ensure that youtube-dl is up to date, you have a valid internet connection, and your search queries pull up results" \ normal dialog-error 10000 - else + elif [ -z "$_optdryrun" ]; then if [ -z "$_optdownloadonly" ]; then notify "Finished building queue" \ "The playlist queue has been built in Audacious" @@ -216,6 +218,8 @@ playlist() { "Your songs have been cached and are ready for offline playback" log "Finished downloading: $dlexist cached, $dlsuccess downloaded, $dlfailure failed" fi + else + log "Finished dry run: $dlsuccess succeeded, $dlfailure failed" fi }