v2.3 - use lidarr tag to prevent endless loop

#230 - Resolves this...
This commit is contained in:
RandomNinjaAtk 2024-08-01 15:32:13 +00:00 committed by GitHub
parent 0989fe8d42
commit e0f8ece474
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,5 @@
#!/usr/bin/with-contenv bash
scriptVersion="2.1"
scriptVersion="2.3"
scriptName="AutoArtistAdder"
### Import Settings
@ -32,6 +32,15 @@ verifyConfig () {
sleepTimer=0.5
GetTag () {
tagId="$(curl -s "$arrUrl/api/v1/tag?apikey=${arrApiKey}" | jq -r '.[] |select(.label=="arr-extended") | .id')"
}
AddTag () {
log "adding arr-extended tag"
lidarrProcessIt=$(curl -s "$arrUrl/api/v1/tag" --header "X-Api-Key:"${arrApiKey} -H "Content-Type: application/json" --data-raw '{"label":"arr-extended"}')
}
NotifyWebhook () {
if [ "$webHook" ]
@ -109,6 +118,7 @@ AddDeezerArtistToLidarr () {
qualityProfileId=$(echo $qualityProfileId | cut -d' ' -f1)
metadataProfileId="$(echo "$data" | jq -r ".defaultMetadataProfileId")"
metadataProfileId=$(echo $metadataProfileId | cut -d' ' -f1)
GetTag
data="{
\"artistName\": \"$artistName\",
\"foreignArtistId\": \"$foreignId\",
@ -117,6 +127,7 @@ AddDeezerArtistToLidarr () {
\"monitored\":$autoArtistAdderMonitored,
\"monitor\":\"all\",
\"rootFolderPath\": \"$path\",
\"tags\": [ $tagId ],
\"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing}
}"
if echo "$lidarrArtistIds" | grep "^${foreignId}$" | read; then
@ -159,6 +170,13 @@ AddDeezerRelatedArtists () {
log "$artistNumber of $lidarrArtistTotal :: $wantedAlbumListSource :: $lidarrArtistName :: Artist is not monitored :: skipping..."
continue
fi
if [ $preventRelatedArtistsLoop == "true" ]; then
GetTag
if echo "$lidarrArtistData" | jq -r .tags[] | grep "$tagId" | read; then
log "$artistNumber of $lidarrArtistTotal :: $lidarrArtistName :: This artist was added via related artist, skipping..."
continue
fi
fi
for dId in ${!deezerArtistIds[@]}; do
deezerArtistId="${deezerArtistIds[$dId]}"
@ -211,6 +229,13 @@ AddTidalRelatedArtists () {
log "$artistNumber of $lidarrArtistTotal :: $lidarrArtistName :: Artist is not monitored :: skipping..."
continue
fi
if [ $preventRelatedArtistsLoop == "true" ]; then
GetTag
if echo "$lidarrArtistData" | jq -r .tags[] | grep "$tagId" | read; then
log "$artistNumber of $lidarrArtistTotal :: $lidarrArtistName :: This artist was added via related artist, skipping..."
continue
fi
fi
for Id in ${!serviceArtistIds[@]}; do
serviceArtistId="${serviceArtistIds[$Id]}"
@ -260,6 +285,7 @@ AddTidalArtistToLidarr () {
qualityProfileId=$(echo $qualityProfileId | cut -d' ' -f1)
metadataProfileId="$(echo "$data" | jq -r ".defaultMetadataProfileId")"
metadataProfileId=$(echo $metadataProfileId | cut -d' ' -f1)
GetTag
data="{
\"artistName\": \"$artistName\",
\"foreignArtistId\": \"$foreignId\",
@ -268,6 +294,7 @@ AddTidalArtistToLidarr () {
\"monitored\":$autoArtistAdderMonitored,
\"monitor\":\"all\",
\"rootFolderPath\": \"$path\",
\"tags\": [ $tagId ],
\"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing}
}"
if echo "$lidarrArtistIds" | grep "^${foreignId}$" | read; then
@ -294,6 +321,7 @@ for (( ; ; )); do
verifyConfig
getArrAppInfo
verifyApiAccess
AddTag
if [ -z $lidarrSearchForMissing ]; then
lidarrSearchForMissing=true