@ -1,5 +1,5 @@
#!/usr/bin/env bash
scriptVersion = "1.0.22 6 "
scriptVersion = "1.0.22 7 "
if [ -z " $lidarrUrl " ] || [ -z " $lidarrApiKey " ] ; then
lidarrUrlBase = " $( cat /config/config.xml | xq | jq -r .Config.UrlBase) "
if [ " $lidarrUrlBase " = "null" ] ; then
@ -460,18 +460,18 @@ DownloadProcess () {
downloadedAlbumTitleClean = " $( echo " $4 " | sed -e "s%[^[:alpha:][:digit:]._' ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' ) "
if find $downloadPath /complete -type d -iname " $lidarrArtistNameSanitized - $downloadedAlbumTitleClean ( $3 )-*- $1 - $2 " | read; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Downloaded... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Downloaded... "
return
fi
# check for log file
if [ " $2 " = "DEEZER" ] ; then
if [ -f /config/extended/logs/downloaded/deezer/$1 ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Downloaded ( $1 )... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Downloaded ( $1 )... "
return
fi
if [ -f /config/extended/logs/downloaded/failed/deezer/$1 ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Attempted Download ( $1 )... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Attempted Download ( $1 )... "
return
fi
fi
@ -479,11 +479,11 @@ DownloadProcess () {
# check for log file
if [ " $2 " = "TIDAL" ] ; then
if [ -f /config/extended/logs/downloaded/tidal/$1 ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Downloaded ( $1 )... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Downloaded ( $1 )... "
return
fi
if [ -f /config/extended/logs/downloaded/failed/tidal/$1 ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Attempted Download ( $1 )... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: Previously Attempted Download ( $1 )... "
return
fi
fi
@ -501,7 +501,7 @@ DownloadProcess () {
touch /temp-download
sleep 0.1
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Download Attempt number $downloadTry "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Download Attempt number $downloadTry "
if [ " $2 " = "DEEZER" ] ; then
if [ $downloadTry = 1 ] ; then
DeezerClientTest
@ -524,19 +524,19 @@ DownloadProcess () {
find " $downloadPath /incomplete " -type f -iname "*.flac" -newer "/temp-download" -print0 | while IFS = read -r -d '' file; do
audioFlacVerification " $file "
if [ $verifiedFlacFile = 0 ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Flac Verification :: $file :: Verified "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Flac Verification :: $file :: Verified "
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Flac Verification :: $file :: ERROR :: Failed Verification "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Flac Verification :: $file :: ERROR :: Failed Verification "
rm " $file "
fi
done
downloadCount = $( find $downloadPath /incomplete/ -type f -regex ".*/.*\.\(flac\|m4a\|mp3\)" | wc -l)
if [ $downloadCount -ne $5 ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: download failed, missing tracks... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: download failed, missing tracks... "
completedVerification = "false"
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Success "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Success "
completedVerification = "true"
fi
@ -548,14 +548,14 @@ DownloadProcess () {
fi
break
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Retry Download in 1 second fix errors... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Retry Download in 1 second fix errors... "
sleep 1
fi
done
# Consolidate files to a single folder
if [ " $2 " = "TIDAL" ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Consolidating files to single folder "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Consolidating files to single folder "
find " $downloadPath /incomplete " -type f -exec mv "{}" $downloadPath /incomplete/ \;
if [ -d $downloadPath /incomplete/atd ] ; then
rm -rf $downloadPath /incomplete/atd
@ -570,8 +570,8 @@ DownloadProcess () {
downloadCount = $( find $downloadPath /incomplete/ -type f -regex ".*/.*\.\(flac\|m4a\|mp3\)" | wc -l)
if [ $downloadCount -ne $5 ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: All download Attempts failed... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Logging $1 as failed download... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: ERROR :: All download Attempts failed... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Logging $1 as failed download... "
if [ " $2 " = "DEEZER" ] ; then
@ -584,7 +584,7 @@ DownloadProcess () {
fi
# Log Completed Download
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Logging $1 as successfully downloaded... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Logging $1 as successfully downloaded... "
if [ " $2 " = "DEEZER" ] ; then
touch /config/extended/logs/downloaded/deezer/$1
fi
@ -593,7 +593,7 @@ DownloadProcess () {
fi
if [ $audioFormat != native ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Converting Flac Audio to ${ audioFormat ^^ } ${ audioBitrate } k "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Converting Flac Audio to ${ audioFormat ^^ } ${ audioBitrate } k "
if [ $audioFormat = opus ] ; then
options = " -acodec libopus -ab ${ audioBitrate } k -application audio -vbr off "
extension = "opus"
@ -620,10 +620,10 @@ DownloadProcess () {
foldername = " $( dirname " $audio " ) "
filenamenoext = " ${ filename %.* } "
if ffmpeg -loglevel warning -hide_banner -nostats -i " $file " -n -vn $options " $foldername / ${ filenamenoext } . $extension " < /dev/null; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: $filename :: Conversion to $audioFormat ( ${ audioBitrate } k) successful "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: $filename :: Conversion to $audioFormat ( ${ audioBitrate } k) successful "
rm " $file "
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: $filename :: ERROR :: Conversion Failed "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: $filename :: ERROR :: Conversion Failed "
rm " $foldername / ${ filenamenoext } . $extension "
fi
done
@ -633,13 +633,13 @@ DownloadProcess () {
if [ $enableReplaygainTags = true ] ; then
AddReplaygainTags " $downloadPath /incomplete "
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Replaygain Tagging Disabled (set enableReplaygainTags=true to enable...) "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Replaygain Tagging Disabled (set enableReplaygainTags=true to enable...) "
fi
find " $downloadPath /incomplete " -type f -iname "*.flac" -print0 | while IFS = read -r -d '' file; do
lrcFile = " ${ file %.* } .lrc "
if [ -f " $lrcFile " ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Embedding lyrics (lrc) into $file "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Embedding lyrics (lrc) into $file "
metaflac --remove-tag= Lyrics " $file "
metaflac --set-tag-from-file= " Lyrics= $lrcFile " " $file "
rm " $lrcFile "
@ -678,66 +678,66 @@ DownloadProcess () {
DownloadQualityCheck ( ) {
if [ " $requireQuality " = "true" ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Checking for unwanted files "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Checking for unwanted files "
if [ $audioFormat != native ] ; then
if find " $1 " -type f -regex ".*/.*\.\(opus\|m4a\|mp3\)" | read; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Performing cleanup... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Performing cleanup... "
rm " $1 " /*
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: No unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: No unwanted files found! "
fi
fi
if [ $audioFormat = native ] ; then
if [ $audioBitrate = lossless ] ; then
if find " $1 " -type f -regex ".*/.*\.\(opus\|m4a\|mp3\)" | read; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Performing cleanup... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Performing cleanup... "
rm " $1 " /*
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: No unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: No unwanted files found! "
fi
elif [ $2 = DEEZER ] ; then
if find " $1 " -type f -regex ".*/.*\.\(opus\|m4a\|flac\)" | read; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Performing cleanup... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Performing cleanup... "
rm " $1 " /*
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: No unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: No unwanted files found! "
fi
elif [ $2 = TIDAL ] ; then
if find " $1 " -type f -regex ".*/.*\.\(opus\|flac\|mp3\)" | read; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Performing cleanup... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Performing cleanup... "
rm " $1 " /*
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: No unwanted files found! "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: No unwanted files found! "
fi
fi
fi
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Skipping download quality check... (enable by setting: requireQuality=true) "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Skipping download quality check... (enable by setting: requireQuality=true) "
fi
}
AddReplaygainTags ( ) {
# Input Data
# $1 Folder path to scan and add tags
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Adding Replaygain Tags using r128gain "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Adding Replaygain Tags using r128gain "
r128gain -r -a " $1 " & >/dev/null
}
NotifyLidarrForImport ( ) {
LidarrProcessIt = $( curl -s " $lidarrUrl /api/v1/command " --header "X-Api-Key:" ${ lidarrApiKey } -H "Content-Type: application/json" --data " {\"name\":\"DownloadedAlbumsScan\", \"path\":\" $1 \"} " )
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: LIDARR IMPORT NOTIFICATION SENT! :: $1 "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: LIDARR IMPORT NOTIFICATION SENT! :: $1 "
}
NotifyPlexToScan ( ) {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Notifying Plex to Scan :: $lidarrArtistPath "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Notifying Plex to Scan :: $lidarrArtistPath "
bash /config/extended/scripts/PlexNotify.bash " $lidarrArtistPath "
fi
}
@ -854,6 +854,9 @@ ConfigureLidarrWithOptimalSettings () {
log "Configuring Lidarr Track Naming Settings"
postSettingsToLidarr = $( curl -s " $lidarrUrl /api/v1/config/naming " -X PUT -H 'Content-Type: application/json' -H " X-Api-Key: ${ lidarrApiKey } " --data-raw '{"renameTracks":true,"replaceIllegalCharacters":true,"standardTrackFormat":"{Artist Name} - {Album Type} - {Release Year} - {Album Title}{ (Album Disambiguation)}/{medium:00}{track:00} - {Track Title}","multiDiscTrackFormat":"{Artist Name} - {Album Type} - {Release Year} - {Album Title}{ (Album Disambiguation)}/{medium:00}{track:00} - {Track Title}","artistFolderFormat":"{Artist Name}{ (Artist Disambiguation)}","includeArtistName":false,"includeAlbumTitle":false,"includeQuality":false,"replaceSpaces":false,"id":1}' )
postSettingsToLidarr = $( curl -s " $lidarrUrl /api/v1/config/naming " -X PUT -H 'Content-Type: application/json' -H " X-Api-Key: ${ lidarrApiKey } " --data-raw '{"renameTracks":true,"replaceIllegalCharacters":true,"standardTrackFormat":"{Artist Name} - {Album Type} - {Release Year} - {Album Title}{ (Album Disambiguation)}/{medium:00}{track:00} - {Track Title}","multiDiscTrackFormat":"{Artist Name} - {Album Type} - {Release Year} - {Album Title}{ (Album Disambiguation)}/{medium:00}{track:00} - {Track Title}","artistFolderFormat":"{Artist Name}{ (Artist Disambiguation)}","includeArtistName":false,"includeAlbumTitle":false,"includeQuality":false,"replaceSpaces":false,"id":1}' )
postSettingsToLidarr = $( curl -s " $lidarrUrl /api/v1/config/naming " -X PUT -H 'Content-Type: application/json' -H " X-Api-Key: ${ lidarrApiKey } " --data-raw '{"renameTracks":true,"replaceIllegalCharacters":true,"standardTrackFormat":"{Artist Name} - {Album Type} - {Release Year} - {Album Title}{ (Album Disambiguation)}/{medium:00}{track:00} - {Track Title}","multiDiscTrackFormat":"{Artist Name} - {Album Type} - {Release Year} - {Album Title}{ (Album Disambiguation)}/{medium:00}{track:00} - {Track Title}","artistFolderFormat":"{Artist Name}{ (Artist Disambiguation)}","includeArtistName":false,"includeAlbumTitle":false,"includeQuality":false,"replaceSpaces":false,"id":1}' )
touch /config/extended/logs/autoconfig
chmod 666 /config/extended/logs/autoconfig
@ -1029,7 +1032,7 @@ SearchProcess () {
lidarrArtistPath = " $( echo " ${ lidarrArtistData } " | jq -r " .path" ) "
lidarrArtistFolder = " $( basename " ${ lidarrArtistPath } " ) "
lidarrArtistName = $( echo " ${ lidarrArtistData } " | jq -r ".artistName" )
lidarrArtistNameSanitized = " $( basename " ${ lidarrArtistPath } " | sed 's% (.*)$%%g' ) "
lidarrArtistNameSanitized = " $( basename " ${ lidarrArtistPath } " | sed 's% (.*)$%%g' | sed 's/-/ /g' ) "
lidarrArtistNameSearchSanitized = " $( echo " $lidarrArtistName " | sed -e "s%[^[:alpha:][:digit:]]% %g" -e "s/ */ /g" ) "
albumArtistNameSearch = " $( jq -R -r @uri <<< " ${ lidarrArtistNameSearchSanitized } " ) "
lidarrArtistForeignArtistId = $( echo " ${ lidarrArtistData } " | jq -r ".foreignArtistId" )
@ -1181,7 +1184,7 @@ SearchProcess () {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
break 2
fi
@ -1197,7 +1200,7 @@ SearchProcess () {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
break 2
fi
@ -1215,7 +1218,7 @@ SearchProcess () {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
break 2
fi
@ -1229,7 +1232,7 @@ SearchProcess () {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
break 2
fi
@ -1252,7 +1255,7 @@ SearchProcess () {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
continue
fi
@ -1282,7 +1285,7 @@ SearchProcess () {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
continue
fi
else
@ -1295,7 +1298,7 @@ SearchProcess () {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
continue
fi
@ -1323,7 +1326,7 @@ SearchProcess () {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
continue
fi
else
@ -1335,45 +1338,45 @@ SearchProcess () {
LidarrTaskStatusCheck
CheckLidarrBeforeImport " $checkLidarrAlbumId "
if [ $alreadyImported = true ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping... "
continue
fi
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Album Not found "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Marking Album as notfound "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Album Not found "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Marking Album as notfound "
if [ ! -f " /config/extended/logs/notfound/ $wantedAlbumId -- $lidarrArtistForeignArtistId -- $lidarrAlbumForeignAlbumId " ] ; then
touch " /config/extended/logs/notfound/ $wantedAlbumId -- $lidarrArtistForeignArtistId -- $lidarrAlbumForeignAlbumId "
chmod 666 " /config/extended/logs/notfound/ $wantedAlbumId -- $lidarrArtistForeignArtistId -- $lidarrAlbumForeignAlbumId "
chown abc:abc " /config/extended/logs/notfound/ $wantedAlbumId -- $lidarrArtistForeignArtistId -- $lidarrAlbumForeignAlbumId "
fi
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Search Complete... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Search Complete... "
done
}
GetDeezerAlbumInfo ( ) {
until false
do
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: Getting Album info... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Getting Album info... "
if [ ! -f " /config/extended/cache/deezer/ $1 .json " ] ; then
curl -s " https://api.deezer.com/album/ $1 " -o " /config/extended/cache/deezer/ $1 .json "
sleep $sleepTimer
fi
if [ -f " /config/extended/cache/deezer/ $1 .json " ] ; then
if jq -e . >/dev/null 2>& 1 <<< " $( cat /config/extended/cache/deezer/$1 .json) " ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: Album info downloaded and verified... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Album info downloaded and verified... "
chmod 666 /config/extended/cache/deezer/$1 .json
chown abc:abc /config/extended/cache/deezer/$1 .json
albumInfoVerified = true
break
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: Error getting album information "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Error getting album information "
if [ -f " /config/extended/cache/deezer/ $1 .json " ] ; then
rm " /config/extended/cache/deezer/ $1 .json "
fi
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: Retrying... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Retrying... "
fi
else
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: ERROR :: Download Failed "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: ERROR :: Download Failed "
fi
done
@ -1729,15 +1732,15 @@ CheckLidarrBeforeImport () {
alreadyImported = false
checkLidarrAlbumData = " $( curl -s " $lidarrUrl /api/v1/album/ $1 ?apikey= ${ lidarrApiKey } " ) "
checkLidarrAlbumPercentOfTracks = $( echo " $checkLidarrAlbumData " | jq -r ".statistics.percentOfTracks" )
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Checking Lidarr for existing files "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: $checkLidarrAlbumPercentOfTracks % Tracks found "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Checking Lidarr for existing files "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: $checkLidarrAlbumPercentOfTracks % Tracks found "
if [ " $checkLidarrAlbumPercentOfTracks " = "null" ] ; then
checkLidarrAlbumPercentOfTracks = 0
return
fi
if [ ${ checkLidarrAlbumPercentOfTracks %%.* } -ge 100 ] ; then
if [ $wantedAlbumListSource = missing ] ; then
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName Sanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported Album (Missing), skipping... "
log " $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported Album (Missing), skipping... "
alreadyImported = true
return
fi