@ -1,5 +1,5 @@
#!/usr/bin/env bash
scriptVersion = "1.0.1 59 "
scriptVersion = "1.0.1 60 "
lidarrUrlBase = " $( cat /config/config.xml | xq | jq -r .Config.UrlBase) "
if [ " $lidarrUrlBase " = "null" ] ; then
lidarrUrlBase = ""
@ -1523,6 +1523,20 @@ ArtistDeezerSearch () {
for deezerAlbumID in $( echo $deezerArtistAlbumsIds ) ; do
deezerAlbumData = " $( echo " $deezerSearch " | jq -r " .album | select(.id== $deezerAlbumID ) " ) "
deezerAlbumTitle = $( echo " $deezerAlbumData " | jq -r .title | head -n1)
lidarrAlbumReleaseTitleClean = $( echo " $lidarrAlbumReleaseTitle " | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
deezerAlbumTitleClean = $( echo ${ deezerAlbumTitle } | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
deezerAlbumTitle = $( echo " $deezerAlbumData " | jq -r .title)
# String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath = $(( ${# deezerAlbumTitleClean } - ${# lidarrAlbumReleaseTitleClean } ))
if [ $characterMath -gt 5 ] ; then
continue
elif [ $characterMath -lt 0 ] ; then
continue
fi
if [ -f " /config/extended/cache/deezer/ $deezerAlbumID .json " ] ; then
deezerAlbumData = " $( cat " /config/extended/cache/deezer/ $deezerAlbumID .json " ) "
else
@ -1541,14 +1555,6 @@ ArtistDeezerSearch () {
continue
fi
# String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath = $(( ${# deezerAlbumTitleClean } - ${# lidarrAlbumReleaseTitleClean } ))
if [ $characterMath -gt 5 ] ; then
continue
elif [ $characterMath -lt 0 ] ; then
continue
fi
log " :: $1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Checking for Match... "
log " :: $1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Artist Search :: Deezer :: $type :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Similarity... "
diff = $( levenshtein " ${ lidarrAlbumReleaseTitleClean ,, } " " ${ deezerAlbumTitleClean ,, } " 2>/dev/null)
@ -1621,13 +1627,28 @@ FuzzyDeezerSearch () {
fi
if [ ! -z " $deezerSearch " ] ; then
for deezerAlbumID in $( echo " $deezerSearch " | jq -r .album.id | sort -u) ; do
deezerAlbumData = " $( echo " $deezerSearch " | jq -r " .album | select(.id== $deezerAlbumID ) " ) "
deezerAlbumTitle = $( echo " $deezerAlbumData " | jq -r .title | head -n1)
lidarrAlbumReleaseTitleClean = $( echo " $lidarrAlbumReleaseTitle " | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
deezerAlbumTitleClean = $( echo ${ deezerAlbumTitle } | sed -e "s%[^[:alpha:][:digit:]]%%g" -e "s/ */ /g" | sed 's/^[.]*//' | sed 's/[.]*$//g' | sed 's/^ *//g' | sed 's/ *$//g' )
deezerAlbumTitle = $( echo " $deezerAlbumData " | jq -r .title)
# String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath = $(( ${# deezerAlbumTitleClean } - ${# lidarrAlbumReleaseTitleClean } ))
if [ $characterMath -gt 5 ] ; then
continue
elif [ $characterMath -lt 0 ] ; then
continue
fi
if [ -f " /config/extended/cache/deezer/ $deezerAlbumID .json " ] ; then
deezerAlbumData = " $( cat " /config/extended/cache/deezer/ $deezerAlbumID .json " ) "
else
getDeezerAlbumData = $( curl -s " https://api.deezer.com/album/ $deezerAlbumID " > " /config/extended/cache/deezer/ $deezerAlbumID .json " )
sleep $sleepTimer
deezerAlbumData = " $( cat " /config/extended/cache/deezer/ $deezerAlbumID .json " ) "
sleep $sleepTimer
deezerAlbumData = " $( cat " /config/extended/cache/deezer/ $deezerAlbumID .json " ) "
fi
deezerAlbumTrackCount = " $( echo $deezerAlbumData | jq -r .nb_tracks) "
deezerAlbumExplicitLyrics = " $( echo $deezerAlbumData | jq -r .explicit_lyrics) "
deezerAlbumTitle = $( echo " $deezerAlbumData " | jq -r .title)
@ -1644,14 +1665,6 @@ FuzzyDeezerSearch () {
continue
fi
# String Character Count test, quicker than the levenshtein method to allow faster processing
characterMath = $(( ${# deezerAlbumTitleClean } - ${# lidarrAlbumReleaseTitleClean } ))
if [ $characterMath -gt 5 ] ; then
continue
elif [ $characterMath -lt 0 ] ; then
continue
fi
log " :: $1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Checking for Match... "
log " :: $1 :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Fuzzy Search :: Deezer :: $type :: $lidarrAlbumReleaseTitleClean vs $deezerAlbumTitleClean :: Calculating Similarity... "
diff = $( levenshtein " ${ lidarrAlbumReleaseTitleClean ,, } " " ${ deezerAlbumTitleClean ,, } " 2>/dev/null)