@ -1,5 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env bash
scriptVersion = "1.0. 4 "
scriptVersion = "1.0. 5 "
if [ -z " $lidarrUrl " ] || [ -z " $lidarrApiKey " ] ; then
if [ -z " $lidarrUrl " ] || [ -z " $lidarrApiKey " ] ; then
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
@ -12,8 +12,9 @@ if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then
lidarrPort = " $( cat /config/config.xml | xq | jq -r .Config.Port) "
lidarrPort = " $( cat /config/config.xml | xq | jq -r .Config.Port) "
lidarrUrl = " http://localhost: ${ lidarrPort } ${ lidarrUrlBase } "
lidarrUrl = " http://localhost: ${ lidarrPort } ${ lidarrUrlBase } "
fi
fi
agent = " ${ lidarrAgentInstanceId } ( https://github.com/RandomNinjaAtk/docker-lidarr-extended ) "
agent = " lidarr-extended ( https://github.com/RandomNinjaAtk/docker-lidarr-extended )"
musicbrainzMirror = https://musicbrainz.org
musicbrainzMirror = https://musicbrainz.org
musicbrainzSleep = 5
# Debugging settings
# Debugging settings
#dlClientSource="tidal"
#dlClientSource="tidal"
@ -1156,11 +1157,11 @@ SearchProcess () {
if [ -z " $deezerArtistUrl " ] ; then
if [ -z " $deezerArtistUrl " ] ; then
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: DEEZER :: Fallback to musicbrainz for Deezer ID "
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: DEEZER :: Fallback to musicbrainz for Deezer ID "
musicbrainzArtistData = $( curl -s -A " $agent " " https://musicbrainz.org/ws/2/artist/ ${ lidarrArtistForeignArtistId } ?inc=url-rels&fmt=json " )
musicbrainzArtistData = $( curl -s -A " $agent " " https://musicbrainz.org/ws/2/artist/ ${ lidarrArtistForeignArtistId } ?inc=url-rels&fmt=json " )
sleep $musicbrainzSleep
deezerArtistUrl = $( echo " $musicbrainzArtistData " | jq -r '.relations | .[] | .url | select(.resource | contains("deezer")) | .resource' )
deezerArtistUrl = $( echo " $musicbrainzArtistData " | jq -r '.relations | .[] | .url | select(.resource | contains("deezer")) | .resource' )
fi
fi
if [ -z " $deezerArtistUrl " ] ; then
if [ -z " $deezerArtistUrl " ] ; then
sleep 1.5
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: DEEZER :: ERROR :: musicbrainz id: $lidarrArtistForeignArtistId is missing Deezer link, see: \"/config/logs/deezer-artist-id-not-found.txt\" for more detail... "
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: DEEZER :: ERROR :: musicbrainz id: $lidarrArtistForeignArtistId is missing Deezer link, see: \"/config/logs/deezer-artist-id-not-found.txt\" for more detail... "
touch "/config/logs/deezer-artist-id-not-found.txt"
touch "/config/logs/deezer-artist-id-not-found.txt"
if cat "/config/logs/deezer-artist-id-not-found.txt" | grep " https://musicbrainz.org/artist/ $lidarrArtistForeignArtistId /edit " | read; then
if cat "/config/logs/deezer-artist-id-not-found.txt" | grep " https://musicbrainz.org/artist/ $lidarrArtistForeignArtistId /edit " | read; then
@ -1180,11 +1181,11 @@ SearchProcess () {
if [ -z " $tidalArtistUrl " ] ; then
if [ -z " $tidalArtistUrl " ] ; then
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: TIDAL :: Fallback to musicbrainz for Tidal ID "
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: TIDAL :: Fallback to musicbrainz for Tidal ID "
musicbrainzArtistData = $( curl -s -A " $agent " " https://musicbrainz.org/ws/2/artist/ ${ lidarrArtistForeignArtistId } ?inc=url-rels&fmt=json " )
musicbrainzArtistData = $( curl -s -A " $agent " " https://musicbrainz.org/ws/2/artist/ ${ lidarrArtistForeignArtistId } ?inc=url-rels&fmt=json " )
sleep $musicbrainzSleep
tidalArtistUrl = $( echo " $musicbrainzArtistData " | jq -r '.relations | .[] | .url | select(.resource | contains("tidal")) | .resource' )
tidalArtistUrl = $( echo " $musicbrainzArtistData " | jq -r '.relations | .[] | .url | select(.resource | contains("tidal")) | .resource' )
fi
fi
if [ -z " $tidalArtistUrl " ] ; then
if [ -z " $tidalArtistUrl " ] ; then
sleep 1.5
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: TIDAL :: ERROR :: musicbrainz id: $lidarrArtistForeignArtistId is missing Tidal link, see: \"/config/logs/tidal-artist-id-not-found.txt\" for more detail... "
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: TIDAL :: ERROR :: musicbrainz id: $lidarrArtistForeignArtistId is missing Tidal link, see: \"/config/logs/tidal-artist-id-not-found.txt\" for more detail... "
touch "/config/logs/tidal-artist-id-not-found.txt"
touch "/config/logs/tidal-artist-id-not-found.txt"
if cat "/config/logs/tidal-artist-id-not-found.txt" | grep " https://musicbrainz.org/artist/ $lidarrArtistForeignArtistId /edit " | read; then
if cat "/config/logs/tidal-artist-id-not-found.txt" | grep " https://musicbrainz.org/artist/ $lidarrArtistForeignArtistId /edit " | read; then
@ -1344,7 +1345,7 @@ SearchProcess () {
# Search Musicbrainz
# Search Musicbrainz
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Musicbrainz URL :: Tidal :: Searching for Album ID... "
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Musicbrainz URL :: Tidal :: Searching for Album ID... "
msuicbrainzTidalDownloadAlbumID = $( curl -s -A " $agent " " https://musicbrainz.org/ws/2/release?release-group= $lidarrAlbumForeignAlbumId &inc=url-rels&fmt=json " | jq -r | grep "tidal.com" | head -n 1 | sed -e "s%[^[:digit:]]%%g" )
msuicbrainzTidalDownloadAlbumID = $( curl -s -A " $agent " " https://musicbrainz.org/ws/2/release?release-group= $lidarrAlbumForeignAlbumId &inc=url-rels&fmt=json " | jq -r | grep "tidal.com" | head -n 1 | sed -e "s%[^[:digit:]]%%g" )
sleep $musicbrainzSleep
# Process Album ID if found
# Process Album ID if found
if [ ! -z $msuicbrainzTidalDownloadAlbumID ] ; then
if [ ! -z $msuicbrainzTidalDownloadAlbumID ] ; then
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Musicbrainz URL :: Tidal ::: FOUND! "
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Musicbrainz URL :: Tidal ::: FOUND! "
@ -1388,7 +1389,7 @@ SearchProcess () {
# Search Musicbrainz
# Search Musicbrainz
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Musicbrainz URL :: Deezer :: Searching for Album ID... "
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Musicbrainz URL :: Deezer :: Searching for Album ID... "
musicbrainzDeezerDownloadAlbumID = $( curl -s -A " $agent " " https://musicbrainz.org/ws/2/release?release-group= $lidarrAlbumForeignAlbumId &inc=url-rels&fmt=json " | jq -r | grep "deezer.com" | grep "album" | head -n 1 | sed -e "s%[^[:digit:]]%%g" )
musicbrainzDeezerDownloadAlbumID = $( curl -s -A " $agent " " https://musicbrainz.org/ws/2/release?release-group= $lidarrAlbumForeignAlbumId &inc=url-rels&fmt=json " | jq -r | grep "deezer.com" | grep "album" | head -n 1 | sed -e "s%[^[:digit:]]%%g" )
sleep $musicbrainzSleep
# Process Album ID if found
# Process Album ID if found
if [ ! -z $musicbrainzDeezerDownloadAlbumID ] ; then
if [ ! -z $musicbrainzDeezerDownloadAlbumID ] ; then
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Musicbrainz URL :: Deezer :: FOUND! "
log " $page :: $wantedAlbumListSource :: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: Musicbrainz URL :: Deezer :: FOUND! "