parent
0989fe8d42
commit
e0f8ece474
1 changed files with 31 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
scriptVersion="2.1"
|
scriptVersion="2.3"
|
||||||
scriptName="AutoArtistAdder"
|
scriptName="AutoArtistAdder"
|
||||||
|
|
||||||
### Import Settings
|
### Import Settings
|
||||||
|
@ -32,6 +32,15 @@ verifyConfig () {
|
||||||
|
|
||||||
sleepTimer=0.5
|
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 () {
|
NotifyWebhook () {
|
||||||
if [ "$webHook" ]
|
if [ "$webHook" ]
|
||||||
|
@ -109,6 +118,7 @@ AddDeezerArtistToLidarr () {
|
||||||
qualityProfileId=$(echo $qualityProfileId | cut -d' ' -f1)
|
qualityProfileId=$(echo $qualityProfileId | cut -d' ' -f1)
|
||||||
metadataProfileId="$(echo "$data" | jq -r ".defaultMetadataProfileId")"
|
metadataProfileId="$(echo "$data" | jq -r ".defaultMetadataProfileId")"
|
||||||
metadataProfileId=$(echo $metadataProfileId | cut -d' ' -f1)
|
metadataProfileId=$(echo $metadataProfileId | cut -d' ' -f1)
|
||||||
|
GetTag
|
||||||
data="{
|
data="{
|
||||||
\"artistName\": \"$artistName\",
|
\"artistName\": \"$artistName\",
|
||||||
\"foreignArtistId\": \"$foreignId\",
|
\"foreignArtistId\": \"$foreignId\",
|
||||||
|
@ -117,6 +127,7 @@ AddDeezerArtistToLidarr () {
|
||||||
\"monitored\":$autoArtistAdderMonitored,
|
\"monitored\":$autoArtistAdderMonitored,
|
||||||
\"monitor\":\"all\",
|
\"monitor\":\"all\",
|
||||||
\"rootFolderPath\": \"$path\",
|
\"rootFolderPath\": \"$path\",
|
||||||
|
\"tags\": [ $tagId ],
|
||||||
\"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing}
|
\"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing}
|
||||||
}"
|
}"
|
||||||
if echo "$lidarrArtistIds" | grep "^${foreignId}$" | read; then
|
if echo "$lidarrArtistIds" | grep "^${foreignId}$" | read; then
|
||||||
|
@ -159,6 +170,13 @@ AddDeezerRelatedArtists () {
|
||||||
log "$artistNumber of $lidarrArtistTotal :: $wantedAlbumListSource :: $lidarrArtistName :: Artist is not monitored :: skipping..."
|
log "$artistNumber of $lidarrArtistTotal :: $wantedAlbumListSource :: $lidarrArtistName :: Artist is not monitored :: skipping..."
|
||||||
continue
|
continue
|
||||||
fi
|
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
|
for dId in ${!deezerArtistIds[@]}; do
|
||||||
deezerArtistId="${deezerArtistIds[$dId]}"
|
deezerArtistId="${deezerArtistIds[$dId]}"
|
||||||
|
@ -211,6 +229,13 @@ AddTidalRelatedArtists () {
|
||||||
log "$artistNumber of $lidarrArtistTotal :: $lidarrArtistName :: Artist is not monitored :: skipping..."
|
log "$artistNumber of $lidarrArtistTotal :: $lidarrArtistName :: Artist is not monitored :: skipping..."
|
||||||
continue
|
continue
|
||||||
fi
|
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
|
for Id in ${!serviceArtistIds[@]}; do
|
||||||
serviceArtistId="${serviceArtistIds[$Id]}"
|
serviceArtistId="${serviceArtistIds[$Id]}"
|
||||||
|
@ -260,6 +285,7 @@ AddTidalArtistToLidarr () {
|
||||||
qualityProfileId=$(echo $qualityProfileId | cut -d' ' -f1)
|
qualityProfileId=$(echo $qualityProfileId | cut -d' ' -f1)
|
||||||
metadataProfileId="$(echo "$data" | jq -r ".defaultMetadataProfileId")"
|
metadataProfileId="$(echo "$data" | jq -r ".defaultMetadataProfileId")"
|
||||||
metadataProfileId=$(echo $metadataProfileId | cut -d' ' -f1)
|
metadataProfileId=$(echo $metadataProfileId | cut -d' ' -f1)
|
||||||
|
GetTag
|
||||||
data="{
|
data="{
|
||||||
\"artistName\": \"$artistName\",
|
\"artistName\": \"$artistName\",
|
||||||
\"foreignArtistId\": \"$foreignId\",
|
\"foreignArtistId\": \"$foreignId\",
|
||||||
|
@ -268,6 +294,7 @@ AddTidalArtistToLidarr () {
|
||||||
\"monitored\":$autoArtistAdderMonitored,
|
\"monitored\":$autoArtistAdderMonitored,
|
||||||
\"monitor\":\"all\",
|
\"monitor\":\"all\",
|
||||||
\"rootFolderPath\": \"$path\",
|
\"rootFolderPath\": \"$path\",
|
||||||
|
\"tags\": [ $tagId ],
|
||||||
\"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing}
|
\"addOptions\":{\"searchForMissingAlbums\":$lidarrSearchForMissing}
|
||||||
}"
|
}"
|
||||||
if echo "$lidarrArtistIds" | grep "^${foreignId}$" | read; then
|
if echo "$lidarrArtistIds" | grep "^${foreignId}$" | read; then
|
||||||
|
@ -294,6 +321,7 @@ for (( ; ; )); do
|
||||||
verifyConfig
|
verifyConfig
|
||||||
getArrAppInfo
|
getArrAppInfo
|
||||||
verifyApiAccess
|
verifyApiAccess
|
||||||
|
AddTag
|
||||||
|
|
||||||
if [ -z $lidarrSearchForMissing ]; then
|
if [ -z $lidarrSearchForMissing ]; then
|
||||||
lidarrSearchForMissing=true
|
lidarrSearchForMissing=true
|
||||||
|
|
Loading…
Reference in a new issue