2.7 - Run client test to verify client is working if all download attempts failed...
#40 - Further attempts to mitigate/workaround possible issue
This commit is contained in:
parent
b86b278dd4
commit
2dd51ef713
1 changed files with 82 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
scriptVersion="2.6"
|
scriptVersion="2.7"
|
||||||
scriptName="Audio"
|
scriptName="Audio"
|
||||||
|
|
||||||
### Import Settings
|
### Import Settings
|
||||||
|
@ -26,7 +26,17 @@ verifyConfig () {
|
||||||
if [ -z "$failedDownloadAttemptThreshold" ]; then
|
if [ -z "$failedDownloadAttemptThreshold" ]; then
|
||||||
failedDownloadAttemptThreshold="6"
|
failedDownloadAttemptThreshold="6"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$tidalClientTestDownloadId" ]; then
|
||||||
|
tidalClientTestDownloadId="166356219"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$deezerClientTestDownloadId" ]; then
|
||||||
|
deezerClientTestDownloadId="197472472"
|
||||||
|
fi
|
||||||
|
|
||||||
audioPath="$downloadPath/audio"
|
audioPath="$downloadPath/audio"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration () {
|
Configuration () {
|
||||||
|
@ -302,6 +312,39 @@ TidaldlStatusCheck () {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TidalClientTest () {
|
||||||
|
log "TIDAL :: tidal-dl client setup verification..."
|
||||||
|
i=0
|
||||||
|
while [ $i -lt 3 ]; do
|
||||||
|
i=$(( $i + 1 ))
|
||||||
|
TidaldlStatusCheck
|
||||||
|
tidal-dl -q Normal -o "$audioPath"/incomplete -l "$tidalClientTestDownloadId" &>/dev/null
|
||||||
|
downloadCount=$(find "$audioPath"/incomplete -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
|
||||||
|
if [ $downloadCount -le 0 ]; then
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
tidalClientTest="unknown"
|
||||||
|
if [ $downloadCount -le 0 ]; then
|
||||||
|
if [ -f /config/xdg/.tidal-dl.token.json ]; then
|
||||||
|
rm /config/xdg/.tidal-dl.token.json
|
||||||
|
fi
|
||||||
|
log "TIDAL :: ERROR :: Download failed"
|
||||||
|
log "TIDAL :: ERROR :: You will need to re-authenticate on next script run..."
|
||||||
|
log "TIDAL :: ERROR :: Exiting..."
|
||||||
|
rm -rf "$"/incomplete/*
|
||||||
|
NotifyWebhook "Error" "TIDAL not authenticated but configured"
|
||||||
|
tidalClientTest="failed"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
rm -rf "$"/incomplete/*
|
||||||
|
log "TIDAL :: Successfully Verified"
|
||||||
|
tidalClientTest="success"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
DownloadProcess () {
|
DownloadProcess () {
|
||||||
|
|
||||||
# Required Input Data
|
# Required Input Data
|
||||||
|
@ -426,13 +469,15 @@ DownloadProcess () {
|
||||||
|
|
||||||
# If download failes X times, exit with error...
|
# If download failes X times, exit with error...
|
||||||
if [ $deemixFail -eq $failedDownloadAttemptThreshold ]; then
|
if [ $deemixFail -eq $failedDownloadAttemptThreshold ]; then
|
||||||
log "DEEZER :: ERROR :: Download failed"
|
if [ -z $arlToken ]; then
|
||||||
log "DEEZER :: ERROR :: Please review log for errors in client"
|
rm -rf "$audioPath"/incomplete/*
|
||||||
log "DEEZER :: ERROR :: Try updating your ARL Token to possibly resolve the issue..."
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: All $failedDownloadAttemptThreshold Download Attempts failed, skipping..."
|
||||||
log "DEEZER :: ERROR :: Exiting..."
|
else
|
||||||
rm -rf "$audioPath"/incomplete/*
|
DeezerClientTest
|
||||||
NotifyWebhook "FatalError" "DEEZER not authenticated but configured"
|
if [ "$deezerClientTest" == "success" ];
|
||||||
exit
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: All $failedDownloadAttemptThreshold Download Attempts failed, skipping..."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -453,15 +498,10 @@ DownloadProcess () {
|
||||||
|
|
||||||
# If download failes X times, exit with error...
|
# If download failes X times, exit with error...
|
||||||
if [ $tidaldlFail -eq $failedDownloadAttemptThreshold ]; then
|
if [ $tidaldlFail -eq $failedDownloadAttemptThreshold ]; then
|
||||||
if [ -f /config/xdg/.tidal-dl.token.json ]; then
|
TidalClientTest
|
||||||
rm /config/xdg/.tidal-dl.token.json
|
if [ "$tidalClientTest" == "success" ];
|
||||||
|
log "$page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: All $failedDownloadAttemptThreshold Download Attempts failed, skipping..."
|
||||||
fi
|
fi
|
||||||
log "TIDAL :: ERROR :: Download failed"
|
|
||||||
log "TIDAL :: ERROR :: You will need to re-authenticate on next script run..."
|
|
||||||
log "TIDAL :: ERROR :: Exiting..."
|
|
||||||
rm -rf "$audioPath"/incomplete/*
|
|
||||||
NotifyWebhook "FatalError" "TIDAL not authenticated but configured"
|
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -889,6 +929,32 @@ DeemixClientSetup () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeezerClientTest () {
|
||||||
|
log "DEEZER :: deemix client setup verification..."
|
||||||
|
|
||||||
|
deemix -b 128 -p $audioPath/incomplete "https://www.deezer.com/album/$deezerClientTestDownloadId" &>/dev/null
|
||||||
|
if [ -d "/tmp/deemix-imgs" ]; then
|
||||||
|
rm -rf /tmp/deemix-imgs
|
||||||
|
fi
|
||||||
|
deezerClientTest="unknown"
|
||||||
|
downloadCount=$(find $audioPath/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
|
||||||
|
if [ $downloadCount -le 0 ]; 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..."
|
||||||
|
log "DEEZER :: ERROR :: Exiting..."
|
||||||
|
rm -rf $audioPath/incomplete/*
|
||||||
|
NotifyWebhook "Error" "DEEZER not authenticated but configured"
|
||||||
|
deezerClientTest="fail"
|
||||||
|
exit
|
||||||
|
else
|
||||||
|
rm -rf $audioPath/incomplete/*
|
||||||
|
log "DEEZER :: Successfully Verified"
|
||||||
|
deezerClientTest="success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
LidarrRootFolderCheck () {
|
LidarrRootFolderCheck () {
|
||||||
if curl -s "$arrUrl/api/v1/rootFolder" -H "X-Api-Key: ${arrApiKey}" | sed '1q' | grep "\[\]" | read; then
|
if curl -s "$arrUrl/api/v1/rootFolder" -H "X-Api-Key: ${arrApiKey}" | sed '1q' | grep "\[\]" | read; then
|
||||||
log "ERROR :: No root folder found"
|
log "ERROR :: No root folder found"
|
||||||
|
|
Loading…
Reference in a new issue