1.0.190 - Bug fix for previous code consildation, and more code consildation...

pull/35/head
RandomNinjaAtk 2 years ago committed by GitHub
parent af05d609f0
commit a344e7a07b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,5 @@
#!/usr/bin/env bash
scriptVersion="1.0.189"
scriptVersion="1.0.190"
lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
if [ "$lidarrUrlBase" = "null" ]; then
lidarrUrlBase=""
@ -1068,135 +1068,8 @@ SearchProcess () {
skipTidal=false
fi
# Skip Various Artists album search that is not supported...
if [ "$lidarrArtistForeignArtistId" = "89ad4ac3-39f7-470e-963a-56509c546377" ]; then
# Verify it's not already imported into Lidarr
LidarrTaskStatusCheck
CheckLidarrBeforeImport "$checkLidarrAlbumId" "notbeets"
if [ $alreadyImported = true ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
continue
fi
# Search for explicit matches
if [ $audioLyricType = both ] || [ $audioLyricType = explicit ]; then
if [ "$dlClientSource" = "both" ] || [ "$dlClientSource" = "tidal" ]; then
FuzzyTidalSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "true"
fi
fi
# Verify it's not already imported into Lidarr
LidarrTaskStatusCheck
CheckLidarrBeforeImport "$checkLidarrAlbumId" "notbeets"
if [ $alreadyImported = true ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
continue
fi
# Search for explicit matches
if [ $audioLyricType = both ] || [ $audioLyricType = explicit ]; then
if [ "$dlClientSource" = "both" ] || [ "$dlClientSource" = "deezer" ]; then
FuzzyDeezerSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "false"
fi
fi
# Verify it's not already imported into Lidarr
LidarrTaskStatusCheck
CheckLidarrBeforeImport "$checkLidarrAlbumId" "notbeets"
if [ $alreadyImported = true ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
continue
fi
# Search for clean matches
if [ $audioLyricType = both ] || [ $audioLyricType = clean ]; then
if [ "$dlClientSource" = "both" ] || [ "$dlClientSource" = "tidal" ]; then
FuzzyTidalSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "false"
fi
fi
# Verify it's not already imported into Lidarr
LidarrTaskStatusCheck
CheckLidarrBeforeImport "$checkLidarrAlbumId" "notbeets"
if [ $alreadyImported = true ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
continue
fi
# Search for clean matches
if [ $audioLyricType = both ] || [ $audioLyricType = clean ]; then
if [ "$dlClientSource" = "both" ] || [ "$dlClientSource" = "deezer" ]; then
FuzzyDeezerSearch "$processNumber of $wantedListAlbumTotal" "$wantedAlbumId" "false"
fi
fi
# Verify it's not already imported into Lidarr
LidarrTaskStatusCheck
CheckLidarrBeforeImport "$checkLidarrAlbumId" "notbeets"
if [ $alreadyImported = true ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
continue
fi
fi
if [ "$skipDeezer" = "false" ]; then
# fallback to musicbrainz db for link
if [ -z "$deezerArtistUrl" ]; then
log ":: $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")
deezerArtistUrl=$(echo "$musicbrainzArtistData" | jq -r '.relations | .[] | .url | select(.resource | contains("deezer")) | .resource')
fi
if [ -z "$deezerArtistUrl" ]; then
sleep 1.5
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistName :: $lidarrAlbumTitle :: $lidarrAlbumType :: DEEZER :: ERROR :: musicbrainz id: $lidarrArtistForeignArtistId is missing Tidal link, see: \"/config/logs/deezer-artist-id-not-found.txt\" for more detail..."
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/relationships" | read; then
sleep 0.01
else
echo "Update Musicbrainz Relationship Page: https://musicbrainz.org/artist/$lidarrArtistForeignArtistId/relationships for \"${lidarrArtistName}\" with Deezer Artist Link" >> "/config/logs/deezer-artist-id-not-found.txt"
chmod 666 "/config/logs/deezer-artist-id-not-found.txt"
chown abc:abc "/config/logs/deezer-artist-id-not-found.txt"
fi
skipDeezer=true
fi
deezerArtistIds=($(echo "$deezerArtistUrl" | grep -o '[[:digit:]]*' | sort -u))
fi
if [ "$skipTidal" = "false" ]; then
# fallback to musicbrainz db for link
if [ -z "$tidalArtistUrl" ]; then
log ":: $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")
tidalArtistUrl=$(echo "$musicbrainzArtistData" | jq -r '.relations | .[] | .url | select(.resource | contains("tidal")) | .resource')
fi
if [ -z "$tidalArtistUrl" ]; then
sleep 1.5
log ":: $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"
if cat "/config/logs/tidal-artist-id-not-found.txt" | grep "https://musicbrainz.org/artist/$lidarrArtistForeignArtistId/relationships" | read; then
sleep 0.01
else
echo "Update Musicbrainz Relationship Page: https://musicbrainz.org/artist/$lidarrArtistForeignArtistId/relationships for \"${lidarrArtistName}\" with Tidal Artist Link" >> "/config/logs/tidal-artist-id-not-found.txt"
chmod 666 "/config/logs/tidal-artist-id-not-found.txt"
chown abc:abc "/config/logs/tidal-artist-id-not-found.txt"
fi
skipTidal=true
fi
fi
LidarrTaskStatusCheck
CheckLidarrBeforeImport "$checkLidarrAlbumId" "notbeets"
if [ $alreadyImported = true ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
continue
fi
# Begin non VA cosolidated search process
if [ "$lidarrArtistForeignArtistId" != "89ad4ac3-39f7-470e-963a-56509c546377" ]; then
# Begin cosolidated search process
if [ $audioLyricType = both ]; then
endLoop=2
else
@ -1230,12 +1103,41 @@ SearchProcess () {
albumTitleSearch="$(jq -R -r @uri <<<"${lidarrAlbumReleaseTitleSearchClean}")"
# Debugging :: echo "$lidarrAlbumReleaseTitle :: $lidarrAlbumReleaseTrackCount :: $lidarrAlbumReleaseTitleFirstWord :: $albumArtistNameSearch :: $albumTitleSearch"
# Tidal Artist search
if [ "$skipTidal" = "false" ]; then
for tidalArtistId in $(echo $tidalArtistIds); do
ArtistTidalSearch "$processNumber of $wantedListAlbumTotal" "$tidalArtistId" "$lyricFilter"
sleep 0.01
done
# Skip Various Artists album search that is not supported...
if [ "$lidarrArtistForeignArtistId" != "89ad4ac3-39f7-470e-963a-56509c546377" ]; then
# Lidarr Status Check
LidarrTaskStatusCheck
CheckLidarrBeforeImport "$checkLidarrAlbumId" "notbeets"
if [ $alreadyImported = true ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
break 2
fi
# Tidal Artist search
if [ "$skipTidal" = "false" ]; then
for tidalArtistId in $(echo $tidalArtistIds); do
ArtistTidalSearch "$processNumber of $wantedListAlbumTotal" "$tidalArtistId" "$lyricFilter"
sleep 0.01
done
fi
# Lidarr Status Check
LidarrTaskStatusCheck
CheckLidarrBeforeImport "$checkLidarrAlbumId" "notbeets"
if [ $alreadyImported = true ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
break 2
fi
# Deezer artist search
if [ "$skipDeezer" = "false" ]; then
for dId in ${!deezerArtistIds[@]}; do
deezerArtistId="${deezerArtistIds[$dId]}"
ArtistDeezerSearch "$processNumber of $wantedListAlbumTotal" "$deezerArtistId" "$lyricFilter"
sleep 0.01
done
fi
fi
# Lidarr Status Check
@ -1260,23 +1162,6 @@ SearchProcess () {
break 2
fi
# Deezer artist search
if [ "$skipDeezer" = "false" ]; then
for dId in ${!deezerArtistIds[@]}; do
deezerArtistId="${deezerArtistIds[$dId]}"
ArtistDeezerSearch "$processNumber of $wantedListAlbumTotal" "$deezerArtistId" "$lyricFilter"
sleep 0.01
done
fi
# Lidarr Status Check
LidarrTaskStatusCheck
CheckLidarrBeforeImport "$checkLidarrAlbumId" "notbeets"
if [ $alreadyImported = true ]; then
log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $lidarrAlbumType :: Already Imported, skipping..."
break 2
fi
# Deezer fuzzy search
if [ "$dlClientSource" = "both" ] || [ "$dlClientSource" = "deezer" ]; then
FuzzyDeezerSearch "$processNumber of $wantedListAlbumTotal" "$lyricFilter"
@ -1290,7 +1175,7 @@ SearchProcess () {
break
fi
done
fi
# Lidarr Status Check
LidarrTaskStatusCheck

Loading…
Cancel
Save