1.0.136 - Swap service search order, because synced lyrics are more accurate

pull/16/head
RandomNinjaAtk 2 years ago committed by GitHub
parent bb5c1db939
commit 267097108c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
scriptVersion="1.0.135" scriptVersion="1.0.136"
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=""
@ -1049,9 +1049,9 @@ SearchProcess () {
skipTidal=false skipTidal=false
fi fi
# Search Musicbrainz for Deezer Album ID # Search Musicbrainz for Tidal Album ID
if [ $audioLyricType = both ]; then if [ $audioLyricType = both ]; then
if [ "$skipDeezer" = "false" ]; then if [ "$skipTidal" = "false" ]; then
# Verify it's not already imported into Lidarr # Verify it's not already imported into Lidarr
LidarrTaskStatusCheck LidarrTaskStatusCheck
CheckLidarrBeforeImport "$lidarrAlbumForeignAlbumId" "notbeets" CheckLidarrBeforeImport "$lidarrAlbumForeignAlbumId" "notbeets"
@ -1061,20 +1061,15 @@ SearchProcess () {
fi fi
# Search Musicbrainz # Search Musicbrainz
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Deezer Album ID :: Searching for Album ID..." log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Tidal Album ID :: Searching for Album ID..."
msuicbrainzDeezerDownloadAlbumID=$(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") 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 1.5 sleep 1.5
# Process Album ID if found # Process Album ID if found
if [ ! -z $msuicbrainzDeezerDownloadAlbumID ]; then if [ ! -z $msuicbrainzTidalDownloadAlbumID ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Deezer Album ID :: FOUND!" log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Tidal Album ID :: FOUND!"
if [ -f "/config/extended/cache/deezer/${msuicbrainzDeezerDownloadAlbumID}.json" ]; then tidalArtistAlbumData="$(curl -s "https://api.tidal.com/v1/albums/${msuicbrainzTidalDownloadAlbumID}?countryCode=$tidalCountryCode" -H 'x-tidal-token: CzET4vdadNUFQ5JU')"
deezerArtistAlbumData="$(cat "/config/extended/cache/deezer/${msuicbrainzDeezerDownloadAlbumID}.json")" DownloadProcess "$msuicbrainzTidalDownloadAlbumID" "TIDAL" "$lidarrAlbumReleaseYear" "$lidarrAlbumTitle"
else
deezerArtistAlbumData="$(curl -s "https://api.deezer.com/album/${msuicbrainzDeezerDownloadAlbumID}")"
fi
DownloadProcess "$msuicbrainzDeezerDownloadAlbumID" "DEEZER" "$lidarrAlbumReleaseYear" "$lidarrAlbumTitle"
# Verify it was successfully imported into Lidarr # Verify it was successfully imported into Lidarr
LidarrTaskStatusCheck LidarrTaskStatusCheck
@ -1084,14 +1079,14 @@ SearchProcess () {
continue continue
fi fi
else else
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Deezer Album ID :: NOT FOUND!" log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Tidal Album ID :: NOT FOUND!"
fi fi
fi fi
fi fi
# Search Musicbrainz for Tidal Album ID # Search Musicbrainz for Deezer Album ID
if [ $audioLyricType = both ]; then if [ $audioLyricType = both ]; then
if [ "$skipTidal" = "false" ]; then if [ "$skipDeezer" = "false" ]; then
# Verify it's not already imported into Lidarr # Verify it's not already imported into Lidarr
LidarrTaskStatusCheck LidarrTaskStatusCheck
CheckLidarrBeforeImport "$lidarrAlbumForeignAlbumId" "notbeets" CheckLidarrBeforeImport "$lidarrAlbumForeignAlbumId" "notbeets"
@ -1101,15 +1096,20 @@ SearchProcess () {
fi fi
# Search Musicbrainz # Search Musicbrainz
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Tidal Album ID :: Searching for Album ID..." log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Deezer Album ID :: 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") msuicbrainzDeezerDownloadAlbumID=$(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 1.5 sleep 1.5
# Process Album ID if found # Process Album ID if found
if [ ! -z $msuicbrainzTidalDownloadAlbumID ]; then if [ ! -z $msuicbrainzDeezerDownloadAlbumID ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Tidal Album ID :: FOUND!" log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Deezer Album ID :: FOUND!"
tidalArtistAlbumData="$(curl -s "https://api.tidal.com/v1/albums/${msuicbrainzTidalDownloadAlbumID}?countryCode=$tidalCountryCode" -H 'x-tidal-token: CzET4vdadNUFQ5JU')" if [ -f "/config/extended/cache/deezer/${msuicbrainzDeezerDownloadAlbumID}.json" ]; then
DownloadProcess "$msuicbrainzTidalDownloadAlbumID" "TIDAL" "$lidarrAlbumReleaseYear" "$lidarrAlbumTitle" deezerArtistAlbumData="$(cat "/config/extended/cache/deezer/${msuicbrainzDeezerDownloadAlbumID}.json")"
else
deezerArtistAlbumData="$(curl -s "https://api.deezer.com/album/${msuicbrainzDeezerDownloadAlbumID}")"
fi
DownloadProcess "$msuicbrainzDeezerDownloadAlbumID" "DEEZER" "$lidarrAlbumReleaseYear" "$lidarrAlbumTitle"
# Verify it was successfully imported into Lidarr # Verify it was successfully imported into Lidarr
LidarrTaskStatusCheck LidarrTaskStatusCheck
@ -1119,7 +1119,7 @@ SearchProcess () {
continue continue
fi fi
else else
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Tidal Album ID :: NOT FOUND!" log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: Musicbrainz Deezer Album ID :: NOT FOUND!"
fi fi
fi fi
fi fi
@ -1234,18 +1234,17 @@ SearchProcess () {
# Search for explicit matches # Search for explicit matches
if [ $audioLyricType = both ] || [ $audioLyricType = explicit ]; then if [ $audioLyricType = both ] || [ $audioLyricType = explicit ]; then
# Deezer search # Tidal search
if [ "$skipDeezer" = "false" ]; then if [ "$skipTidal" = "false" ]; then
for dId in ${!deezeArtistIds[@]}; do for tidalArtistId in $(echo $tidalArtistIds); do
deezeArtistId="${deezeArtistIds[$dId]}" if [ ! -f "/config/extended/cache/tidal/$tidalArtistId-albums.json" ]; then
if [ ! -f "/config/extended/cache/deezer/$deezeArtistId-albums.json" ]; then
continue continue
fi fi
ArtistDeezerSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "$deezeArtistId" "true" ArtistTidalSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "$tidalArtistId" "true"
done done
fi fi
LidarrTaskStatusCheck LidarrTaskStatusCheck
CheckLidarrBeforeImport "$lidarrAlbumForeignAlbumId" "notbeets" CheckLidarrBeforeImport "$lidarrAlbumForeignAlbumId" "notbeets"
if [ $alreadyImported = true ]; then if [ $alreadyImported = true ]; then
@ -1253,15 +1252,16 @@ SearchProcess () {
continue continue
fi fi
# Tidal search # Deezer search
if [ "$skipTidal" = "false" ]; then if [ "$skipDeezer" = "false" ]; then
for tidalArtistId in $(echo $tidalArtistIds); do for dId in ${!deezeArtistIds[@]}; do
if [ ! -f "/config/extended/cache/tidal/$tidalArtistId-albums.json" ]; then deezeArtistId="${deezeArtistIds[$dId]}"
if [ ! -f "/config/extended/cache/deezer/$deezeArtistId-albums.json" ]; then
continue continue
fi fi
ArtistTidalSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "$tidalArtistId" "true" ArtistDeezerSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "$deezeArtistId" "true"
done done
fi fi
fi fi
@ -1274,18 +1274,18 @@ SearchProcess () {
# Search for clean matches # Search for clean matches
if [ $audioLyricType = both ] || [ $audioLyricType = clean ]; then if [ $audioLyricType = both ] || [ $audioLyricType = clean ]; then
# Deezer search # Tidal search
if [ "$skipDeezer" = "false" ]; then if [ "$skipTidal" = "false" ]; then
for dId in ${!deezeArtistIds[@]}; do
deezeArtistId="${deezeArtistIds[$dId]}" for tidalArtistId in $(echo $tidalArtistIds); do
if [ ! -f "/config/extended/cache/deezer/$deezeArtistId-albums.json" ]; then if [ ! -f "/config/extended/cache/tidal/$tidalArtistId-albums.json" ]; then
continue continue
fi fi
ArtistDeezerSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "$deezeArtistId" "false" ArtistTidalSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "$tidalArtistId" "false"
done done
fi fi
LidarrTaskStatusCheck LidarrTaskStatusCheck
CheckLidarrBeforeImport "$lidarrAlbumForeignAlbumId" "notbeets" CheckLidarrBeforeImport "$lidarrAlbumForeignAlbumId" "notbeets"
if [ $alreadyImported = true ]; then if [ $alreadyImported = true ]; then
@ -1293,15 +1293,15 @@ SearchProcess () {
continue continue
fi fi
# Tidal search # Deezer search
if [ "$skipTidal" = "false" ]; then if [ "$skipDeezer" = "false" ]; then
for dId in ${!deezeArtistIds[@]}; do
for tidalArtistId in $(echo $tidalArtistIds); do deezeArtistId="${deezeArtistIds[$dId]}"
if [ ! -f "/config/extended/cache/tidal/$tidalArtistId-albums.json" ]; then if [ ! -f "/config/extended/cache/deezer/$deezeArtistId-albums.json" ]; then
continue continue
fi fi
ArtistTidalSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "$tidalArtistId" "false" ArtistDeezerSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "$deezeArtistId" "false"
done done
fi fi
fi fi

Loading…
Cancel
Save