@ -1,5 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
scriptVersion = "1.0.13 0 "
scriptVersion = "1.0.13 1 "
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
lidarrUrlBase = ""
lidarrUrlBase = ""
@ -512,30 +512,96 @@ DownloadProcess () {
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: Previously Downloaded... "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: Previously Downloaded... "
return
return
fi
fi
downloadTry = 0
if [ " $2 " = "DEEZER" ] ; then
if [ " $2 " = "DEEZER" ] ; then
deemix -b $deemixQuality -p /downloads/lidarr-extended/incomplete " https://www.deezer.com/album/ $1 "
until false
if [ -d "/tmp/deemix-imgs" ] ; then
do
rm -rf /tmp/deemix-imgs
downloadTry = $(( $downloadTry + 1 ))
fi
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Download Attempt number $downloadTry "
touch /config/extended/logs/downloaded/deezer/$1
deemix -b $deemixQuality -p /downloads/lidarr-extended/incomplete " https://www.deezer.com/album/ $1 "
downloadCount = $( find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
if [ -d "/tmp/deemix-imgs" ] ; then
if [ $downloadCount -le 0 ] ; then
rm -rf /tmp/deemix-imgs
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: download failed "
fi
return
touch /config/extended/logs/downloaded/deezer/$1
fi
downloadCount = $( find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
if [ $downloadCount -le 0 ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: download failed "
completedVerification = "false"
else
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Success "
completedVerification = "true"
fi
find "/downloads/lidarr-extended/incomplete" -type f -iname "*.flac" -print0 | while IFS = read -r -d '' file; do
audioFlacVerification " $file "
if [ $verifiedFlacFile = 0 ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Flac Verification :: $file :: Verified "
completedVerfication = "true"
else
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Flac Verification :: $file :: ERROR :: Failed Verification "
rm " $file "
completedVerification = "false"
break
fi
done
if [ " $completedVerification " = "true" ] ; then
break
elif [ $downloadTry = 5 ] ; then
rm /downloads/lidarr-extended/incomplete/*
break
else
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Retry Download to fix errors... "
fi
done
elif [ " $2 " = "TIDAL" ] ; then
elif [ " $2 " = "TIDAL" ] ; then
tidal-dl -o /downloads/lidarr-extended/incomplete -l " $1 "
until false
touch /config/extended/logs/downloaded/tidal/$1
do
downloadCount = $( find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
downloadTry = $(( $downloadTry + 1 ))
if [ $downloadCount -le 0 ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Download Attempt number $downloadTry "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: download failed "
tidal-dl -o /downloads/lidarr-extended/incomplete -l " $1 "
return
touch /config/extended/logs/downloaded/tidal/$1
fi
downloadCount = $( find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
if [ $downloadCount -le 0 ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: download failed "
completedVerification = false
else
completedVerification = true
fi
find "/downloads/lidarr-extended/incomplete" -type f -iname "*.flac" -print0 | while IFS = read -r -d '' file; do
audioFlacVerification " $file "
if [ $verifiedFlacFile = 0 ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Flac Verification :: $file :: Verified "
completedVerfication = "true"
else
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Flac Verification :: $file :: ERROR :: Failed Verification "
rm " $file "
completedVerification = "false"
break
fi
done
if [ " $completedVerification " = "true" ] ; then
break
elif [ $downloadTry = 5 ] ; then
rm /downloads/lidarr-extended/incomplete/*
break
else
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Retry Download to fix errors... "
fi
done
else
else
return
return
fi
fi
downloadCount = $( find /downloads/lidarr-extended/incomplete/ -type f -regex ".*/.*\.\(flac\|opus\|m4a\|mp3\)" | wc -l)
if [ $downloadCount -le 0 ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: All download Attempst failed... "
return
fi
if [ $audioFormat != native ] ; then
if [ $audioFormat != native ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Converting Flac Audio to ${ audioFormat ^^ } ${ audioBitrate } k "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Converting Flac Audio to ${ audioFormat ^^ } ${ audioBitrate } k "
if [ $audioFormat = opus ] ; then
if [ $audioFormat = opus ] ; then
@ -1688,6 +1754,13 @@ function levenshtein {
fi
fi
}
}
audioFlacVerification ( ) {
# Test Flac File for errors
# $1 File for verification
verifiedFlacFile = ""
verifiedFlacFile = $( flac --totally-silent -t " $1 " ; echo $? )
}
Configuration
Configuration
if [ " $configureLidarrWithOptimalSettings " = "true" ] ; then
if [ " $configureLidarrWithOptimalSettings " = "true" ] ; then