1.0.297 - Improve cleint verification method

Only fail/exit the script if the client fails 6 times in a row...
pull/139/head
RandomNinjaAtk 2 years ago committed by GitHub
parent c12087b5d7
commit a4f9ae4e66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
scriptVersion="1.0.296" scriptVersion="1.0.297"
if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then
lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
if [ "$lidarrUrlBase" == "null" ]; then if [ "$lidarrUrlBase" == "null" ]; then
@ -32,6 +32,8 @@ musicbrainzMirror=https://musicbrainz.org
#enableBeetsTagging=true #enableBeetsTagging=true
sleepTimer=0.5 sleepTimer=0.5
tidaldlFail=0
deemixFail=0
log () { log () {
m_time=`date "+%F %T"` m_time=`date "+%F %T"`
@ -434,7 +436,16 @@ DownloadProcess () {
# Verify Client Works... # Verify Client Works...
clientTestDlCount=$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) 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 :: Download failed"
log "DEEZER :: ERROR :: Please review log for errors in client" log "DEEZER :: ERROR :: Please review log for errors in client"
log "DEEZER :: ERROR :: Try updating your ARL Token to possibly resolve the issue..." log "DEEZER :: ERROR :: Try updating your ARL Token to possibly resolve the issue..."
@ -452,7 +463,16 @@ DownloadProcess () {
# Verify Client Works... # Verify Client Works...
clientTestDlCount=$(find "$downloadPath"/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l) 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 if [ -f /config/xdg/.tidal-dl.token.json ]; then
rm /config/xdg/.tidal-dl.token.json rm /config/xdg/.tidal-dl.token.json
fi fi

Loading…
Cancel
Save