@ -188,7 +188,8 @@ SearchProcess () {
wantedAlbumId = " ${ wantedListAlbumIds [ $id ] } "
wantedAlbumId = " ${ wantedListAlbumIds [ $id ] } "
lidarrAlbumData = " $( curl -s " $lidarrUrl /api/v1/album/ $wantedAlbumId ?apikey= ${ lidarrApiKey } " ) "
lidarrAlbumData = " $( curl -s " $lidarrUrl /api/v1/album/ $wantedAlbumId ?apikey= ${ lidarrApiKey } " ) "
lidarrAlbumTitle = $( echo " $lidarrAlbumData " | jq -r ".title" )
lidarrAlbumTitle = $( echo " $lidarrAlbumData " | jq -r ".title" )
lidarrAlbumTitleClean = $( echo " $lidarrAlbumTitle " | sed -e "s%[^[:alpha:][:digit:] ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
lidarrAlbumTitleClean = $( echo " $lidarrAlbumTitle " | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
lidarrAlbumForeignAlbumId = $( echo " $lidarrAlbumData " | jq -r ".foreignAlbumId" )
lidarrAlbumReleases = $( echo " $lidarrAlbumData " | jq -r ".releases" )
lidarrAlbumReleases = $( echo " $lidarrAlbumData " | jq -r ".releases" )
#echo $lidarrAlbumData | jq -r
#echo $lidarrAlbumData | jq -r
lidarrAlbumWordCount = $( echo $lidarrAlbumTitle | wc -w)
lidarrAlbumWordCount = $( echo $lidarrAlbumTitle | wc -w)
@ -230,26 +231,38 @@ SearchProcess () {
tidalArtistAlbumsData = $( cat " /config/cache/tidal/ $tidalArtistId -albums.json " | jq -r ".items | sort_by(.numberOfTracks) | sort_by(.explicit) | reverse |.[]" )
tidalArtistAlbumsData = $( cat " /config/cache/tidal/ $tidalArtistId -albums.json " | jq -r ".items | sort_by(.numberOfTracks) | sort_by(.explicit) | reverse |.[]" )
tidalArtistAlbumsIds = ( $( echo " ${ tidalArtistAlbumsData } " | jq -r "select(.explicit==" true") | .id" ) )
tidalArtistAlbumsIds = ( $( echo " ${ tidalArtistAlbumsData } " | jq -r "select(.explicit==" true") | .id" ) )
echo " $lidarrAlbumTitle "
CheckLidarrBeforeImport " $lidarrAlbumForeignAlbumId "
if [ $alreadyImported = true ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Already Imported, skipping... "
return
fi
if echo " ${ deezerArtistAlbumsData } " | jq -r .title | grep -i " ^ $lidarrAlbumTitle " | read; then
if echo " ${ deezerArtistAlbumsData } " | jq -r .title | grep -i " ^ $lidarrAlbumTitle " | read; then
for id in ${ !deezerArtistAlbumsIds[@] } ; do
for id in ${ !deezerArtistAlbumsIds[@] } ; do
processNumberTwo = $(( $id + 1 ))
processNumberTwo = $(( $id + 1 ))
deezerArtistAlbumId = " ${ deezerArtistAlbumsIds [ $id ] } "
deezerArtistAlbumId = " ${ deezerArtistAlbumsIds [ $id ] } "
deezerArtistAlbumData = $( echo " $deezerArtistAlbumsData " | jq -r "select(.id==" $deezerArtistAlbumId ")" )
deezerArtistAlbumData = $( echo " $deezerArtistAlbumsData " | jq -r "select(.id==" $deezerArtistAlbumId ")" )
deezerArtistAlbumTitleClean = $( echo ${ deezerArtistAlbumData } | jq -r .title | sed -e "s%[^[:alpha:][:digit:] ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
deezerArtistAlbumTitleClean = $( echo ${ deezerArtistAlbumData } | jq -r .title | sed -e "s%[^[:alpha:][:digit:] ]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
if echo ${ deezerArtistAlbumTitleClean } | grep -i " ^ $lidarrAlbumTitleClean " | read; then
if echo ${ deezerArtistAlbumTitleClean } | grep -i " ^ $lidarrAlbumTitleClean " | read; then
downloadedAlbumTitle = " $( echo ${ deezerArtistAlbumData } | jq -r .title) "
downloadedAlbumTitle = " $( echo ${ deezerArtistAlbumData } | jq -r .title) "
downloadedReleaseDate = " $( echo ${ deezerArtistAlbumData } | jq -r .release_date) "
downloadedReleaseDate = " $( echo ${ deezerArtistAlbumData } | jq -r .release_date) "
downloadedReleaseYear = " ${ downloadedReleaseDate : 0 : 4 } "
downloadedReleaseYear = " ${ downloadedReleaseDate : 0 : 4 } "
echo "Deezer Explicit MATCH "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumTitleClean vs $deezerArtistAlbumTitleClean :: Explicit Deezer MATCH Found "
if [ -f /config/logs/downloaded/deezer/$deezerArtistAlbumId ] ; then
if [ -f /config/logs/downloaded/deezer/$deezerArtistAlbumId ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Previously Downloaded, skipping... "
continue
continue
fi
fi
DownloadProcess " $deezerArtistAlbumId " "DEEZER" " $downloadedReleaseYear "
DownloadProcess " $deezerArtistAlbumId " "DEEZER" " $downloadedReleaseYear "
fi
fi
done
done
else
else
echo "No Explicit Deezer Match Found"
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: No Explicit Deezer Match Found "
fi
CheckLidarrBeforeImport " $lidarrAlbumForeignAlbumId "
if [ $alreadyImported = true ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Already Imported, skipping... "
return
fi
fi
if echo " ${ tidalArtistAlbumsData } " | jq -r .title | grep -i " ^ $lidarrAlbumTitle " | read; then
if echo " ${ tidalArtistAlbumsData } " | jq -r .title | grep -i " ^ $lidarrAlbumTitle " | read; then
@ -257,7 +270,7 @@ SearchProcess () {
processNumberTwo = $(( $id + 1 ))
processNumberTwo = $(( $id + 1 ))
tidalArtistAlbumId = " ${ tidalArtistAlbumsIds [ $id ] } "
tidalArtistAlbumId = " ${ tidalArtistAlbumsIds [ $id ] } "
tidalArtistAlbumData = $( echo " $tidalArtistAlbumsData " | jq -r "select(.id==" $tidalArtistAlbumId ")" )
tidalArtistAlbumData = $( echo " $tidalArtistAlbumsData " | jq -r "select(.id==" $tidalArtistAlbumId ")" )
tidalArtistAlbumTitleClean = $( echo ${ tidalArtistAlbumData } | jq -r .title | sed -e "s%[^[:alpha:][:digit:] ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
tidalArtistAlbumTitleClean = $( echo ${ tidalArtistAlbumData } | jq -r .title | sed -e "s%[^[:alpha:][:digit:] ]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
if echo ${ tidalArtistAlbumTitleClean } | grep -i " ^ $lidarrAlbumTitleClean " | read; then
if echo ${ tidalArtistAlbumTitleClean } | grep -i " ^ $lidarrAlbumTitleClean " | read; then
downloadedAlbumTitle = " $( echo ${ tidalArtistAlbumData } | jq -r .title) "
downloadedAlbumTitle = " $( echo ${ tidalArtistAlbumData } | jq -r .title) "
downloadedReleaseDate = " $( echo ${ tidalArtistAlbumData } | jq -r .releaseDate) "
downloadedReleaseDate = " $( echo ${ tidalArtistAlbumData } | jq -r .releaseDate) "
@ -265,15 +278,22 @@ SearchProcess () {
downloadedReleaseDate = $( echo $tidalArtistAlbumData | jq -r '.streamStartDate' )
downloadedReleaseDate = $( echo $tidalArtistAlbumData | jq -r '.streamStartDate' )
fi
fi
downloadedReleaseYear = " ${ downloadedReleaseDate : 0 : 4 } "
downloadedReleaseYear = " ${ downloadedReleaseDate : 0 : 4 } "
echo "Tidal Explicit MATCH "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumTitleClean vs $tidalArtistAlbumTitleClean :: Explicit Tidal Match Found "
if [ -f /config/logs/downloaded/tidal/$tidalArtistAlbumId ] ; then
if [ -f /config/logs/downloaded/tidal/$tidalArtistAlbumId ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Previously Downloaded, skipping... "
continue
continue
fi
fi
DownloadProcess " $tidalArtistAlbumId " "TIDAL" " $downloadedReleaseYear "
DownloadProcess " $tidalArtistAlbumId " "TIDAL" " $downloadedReleaseYear "
fi
fi
done
done
else
else
echo "No Explicit Tidal Match Found"
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: No Explicit Tidal Match Found "
fi
CheckLidarrBeforeImport " $lidarrAlbumForeignAlbumId "
if [ $alreadyImported = true ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Already Imported, skipping... "
return
fi
fi
deezerArtistAlbumsIds = ( $( echo " ${ deezerArtistAlbumsData } " | jq -r "select(.explicit_lyrics==" false") | .id" ) )
deezerArtistAlbumsIds = ( $( echo " ${ deezerArtistAlbumsData } " | jq -r "select(.explicit_lyrics==" false") | .id" ) )
@ -284,20 +304,27 @@ SearchProcess () {
deezerArtistAlbumId = " ${ deezerArtistAlbumsIds [ $id ] } "
deezerArtistAlbumId = " ${ deezerArtistAlbumsIds [ $id ] } "
deezerArtistAlbumData = $( echo " $deezerArtistAlbumsData " | jq -r "select(.id==" $deezerArtistAlbumId ")" )
deezerArtistAlbumData = $( echo " $deezerArtistAlbumsData " | jq -r "select(.id==" $deezerArtistAlbumId ")" )
deezerArtistAlbumExplicit = $( echo ${ deezerArtistAlbumData } | jq -r .explicit_lyrics)
deezerArtistAlbumExplicit = $( echo ${ deezerArtistAlbumData } | jq -r .explicit_lyrics)
deezerArtistAlbumTitleClean = $( echo ${ deezerArtistAlbumData } | jq -r .title | sed -e "s%[^[:alpha:][:digit:] ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
deezerArtistAlbumTitleClean = $( echo ${ deezerArtistAlbumData } | jq -r .title | sed -e "s%[^[:alpha:][:digit:] ]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
if echo ${ deezerArtistAlbumTitleClean } | grep -i " ^ $lidarrAlbumTitleClean " | read; then
if echo ${ deezerArtistAlbumTitleClean } | grep -i " ^ $lidarrAlbumTitleClean " | read; then
downloadedAlbumTitle = " $( echo ${ deezerArtistAlbumData } | jq -r .title) "
downloadedAlbumTitle = " $( echo ${ deezerArtistAlbumData } | jq -r .title) "
downloadedReleaseDate = " $( echo ${ deezerArtistAlbumData } | jq -r .release_date) "
downloadedReleaseDate = " $( echo ${ deezerArtistAlbumData } | jq -r .release_date) "
downloadedReleaseYear = " ${ downloadedReleaseDate : 0 : 4 } "
downloadedReleaseYear = " ${ downloadedReleaseDate : 0 : 4 } "
echo "CLEAN Deezer MATCH "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumTitleClean vs $deezerArtistAlbumTitleClean :: CLEAN Deezer MATCH Found "
if [ -f /config/logs/downloaded/deezer/$deezerArtistAlbumId ] ; then
if [ -f /config/logs/downloaded/deezer/$deezerArtistAlbumId ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Previously Downloaded, skipping... "
continue
continue
fi
fi
DownloadProcess " $deezerArtistAlbumId " "DEEZER" " $downloadedReleaseYear "
DownloadProcess " $deezerArtistAlbumId " "DEEZER" " $downloadedReleaseYear "
fi
fi
done
done
else
else
echo "No Clean Deezer Match Found"
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: No Clean Deezer Match Found "
fi
CheckLidarrBeforeImport " $lidarrAlbumForeignAlbumId "
if [ $alreadyImported = true ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Already Imported, skipping... "
return
fi
fi
tidalArtistAlbumsIds = ( $( echo " ${ tidalArtistAlbumsData } " | jq -r "select(.explicit==" false") | .id" ) )
tidalArtistAlbumsIds = ( $( echo " ${ tidalArtistAlbumsData } " | jq -r "select(.explicit==" false") | .id" ) )
@ -307,7 +334,7 @@ SearchProcess () {
processNumberTwo = $(( $id + 1 ))
processNumberTwo = $(( $id + 1 ))
tidalArtistAlbumId = " ${ tidalArtistAlbumsIds [ $id ] } "
tidalArtistAlbumId = " ${ tidalArtistAlbumsIds [ $id ] } "
tidalArtistAlbumData = $( echo " $tidalArtistAlbumsData " | jq -r "select(.id==" $tidalArtistAlbumId ")" )
tidalArtistAlbumData = $( echo " $tidalArtistAlbumsData " | jq -r "select(.id==" $tidalArtistAlbumId ")" )
tidalArtistAlbumTitleClean = $( echo ${ tidalArtistAlbumData } | jq -r .title | sed -e "s%[^[:alpha:][:digit:] ]% %g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
tidalArtistAlbumTitleClean = $( echo ${ tidalArtistAlbumData } | jq -r .title | sed -e "s%[^[:alpha:][:digit:] ]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
if echo ${ tidalArtistAlbumTitleClean } | grep -i " ^ $lidarrAlbumTitleClean " | read; then
if echo ${ tidalArtistAlbumTitleClean } | grep -i " ^ $lidarrAlbumTitleClean " | read; then
downloadedAlbumTitle = " $( echo ${ tidalArtistAlbumData } | jq -r .title) "
downloadedAlbumTitle = " $( echo ${ tidalArtistAlbumData } | jq -r .title) "
downloadedReleaseDate = " $( echo ${ tidalArtistAlbumData } | jq -r .releaseDate) "
downloadedReleaseDate = " $( echo ${ tidalArtistAlbumData } | jq -r .releaseDate) "
@ -315,15 +342,16 @@ SearchProcess () {
downloadedReleaseDate = $( echo $tidalArtistAlbumData | jq -r '.streamStartDate' )
downloadedReleaseDate = $( echo $tidalArtistAlbumData | jq -r '.streamStartDate' )
fi
fi
downloadedReleaseYear = " ${ downloadedReleaseDate : 0 : 4 } "
downloadedReleaseYear = " ${ downloadedReleaseDate : 0 : 4 } "
echo "CLEAN Tidal MATCH "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumTitleClean vs $tidalArtistAlbumTitleClean :: CLEAN Tidal Match Found "
if [ -f /config/logs/downloaded/tidal/$tidalArtistAlbumId ] ; then
if [ -f /config/logs/downloaded/tidal/$tidalArtistAlbumId ] ; then
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Previously Downloaded, skipping... "
continue
continue
fi
fi
DownloadProcess " $tidalArtistAlbumId " "TIDAL" " $downloadedReleaseYear "
DownloadProcess " $tidalArtistAlbumId " "TIDAL" " $downloadedReleaseYear "
fi
fi
done
done
else
else
echo "No Clean Tidal Match Found "
log " :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: No Clean Tidal Match Found "
fi
fi
mkdir -p /config/logs/downloaded/notfound
mkdir -p /config/logs/downloaded/notfound
touch /config/logs/downloaded/notfound/$wantedAlbumId
touch /config/logs/downloaded/notfound/$wantedAlbumId
@ -387,14 +415,8 @@ ProcessWithBeets () {
matchedLidarrAlbumArtistName = " $( echo " $matchedLidarrAlbumData " | jq -r ".artist.artistName" ) "
matchedLidarrAlbumArtistName = " $( echo " $matchedLidarrAlbumData " | jq -r ".artist.artistName" ) "
matchedLidarrAlbumArtistCleanName = " $( echo " $matchedLidarrAlbumData " | jq -r ".artist.cleanName" ) "
matchedLidarrAlbumArtistCleanName = " $( echo " $matchedLidarrAlbumData " | jq -r ".artist.cleanName" ) "
lidarrAlbumData = $( curl -s --header "X-Api-Key:" ${ lidarrApiKey } --request GET " $lidarrUrl /api/v1/album/ " | jq -r ".[]" )
CheckLidarrBeforeImport " $matchedTagsAlbumReleaseGroupId "
if [ $alreadyImported = true ] ; then
lidarrPercentOfTracks = $( echo " $lidarrAlbumData " | jq -r " select(.foreignAlbumId==\" $matchedTagsAlbumReleaseGroupId \") | .statistics.percentOfTracks " )
if [ " $lidarrPercentOfTracks " = "null" ] ; then
lidarrPercentOfTracks = 0
fi
if [ $lidarrPercentOfTracks -gt 0 ] ; then
log ":: ERROR :: Already Imported"
rm -rf " $1 "
rm -rf " $1 "
return
return
fi
fi
@ -435,6 +457,21 @@ ProcessWithBeets () {
fi
fi
}
}
CheckLidarrBeforeImport ( ) {
alreadyImported = false
lidarrAlbumData = $( curl -s --header "X-Api-Key:" ${ lidarrApiKey } --request GET " $lidarrUrl /api/v1/album/ " | jq -r ".[]" )
lidarrPercentOfTracks = $( echo " $lidarrAlbumData " | jq -r " select(.foreignAlbumId==\" $1 \") | .statistics.percentOfTracks " )
if [ " $lidarrPercentOfTracks " = "null" ] ; then
lidarrPercentOfTracks = 0
fi
if [ $lidarrPercentOfTracks -gt 0 ] ; then
log ":: ERROR :: Already Imported"
alreadyImported = true
return
fi
}
GetMissingCutOffList
GetMissingCutOffList
SearchProcess
SearchProcess