From a4f9ae4e663b8b51fbcd0b5c704dbba212683986 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 24 Nov 2022 08:36:14 -0500 Subject: [PATCH] 1.0.297 - Improve cleint verification method Only fail/exit the script if the client fails 6 times in a row... --- root/scripts/Audio.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/root/scripts/Audio.sh b/root/scripts/Audio.sh index b72fa65..6302a33 100644 --- a/root/scripts/Audio.sh +++ b/root/scripts/Audio.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.296" +scriptVersion="1.0.297" if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" if [ "$lidarrUrlBase" == "null" ]; then @@ -32,6 +32,8 @@ musicbrainzMirror=https://musicbrainz.org #enableBeetsTagging=true sleepTimer=0.5 +tidaldlFail=0 +deemixFail=0 log () { m_time=`date "+%F %T"` @@ -434,7 +436,16 @@ DownloadProcess () { # Verify Client Works... clientTestDlCount=$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) - if [ "$clientTestDlCount" -le "0" ]; then + if [ $clientTestDlCount -le 0 ]; then + # Add +1 to failed attempts + deemixFail=$(( $deemixFail + 1)) + else + # Reset for successful download + deemixFail=0 + fi + + # If download failes 6 times, exit with error... + if [ $deemixFail -eq 6 ]; then log "DEEZER :: ERROR :: Download failed" log "DEEZER :: ERROR :: Please review log for errors in client" log "DEEZER :: ERROR :: Try updating your ARL Token to possibly resolve the issue..." @@ -452,7 +463,16 @@ DownloadProcess () { # Verify Client Works... clientTestDlCount=$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) - if [ "$clientTestDlCount" -le "0" ]; then + if [ $clientTestDlCount -le 0 ]; then + # Add +1 to failed attempts + tidaldlFail=$(( $tidaldlFail + 1)) + else + # Reset for successful download + tidaldlFail=0 + fi + + # If download failes 6 times, exit with error... + if [ $tidaldlFail -eq 6 ]; then if [ -f /config/xdg/.tidal-dl.token.json ]; then rm /config/xdg/.tidal-dl.token.json fi