1.0.3 - reset agent to default, increase length between queries

pull/250/head
RandomNinjaAtk 2 years ago committed by GitHub
parent 42519d9a67
commit 7a4a508d93
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.2" scriptVersion="1.0.3"
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
#addRelatedArtists="true" #addRelatedArtists="true"
@ -94,16 +95,16 @@ AddDeezerArtistToLidarr () {
query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22https://www.deezer.com/artist/${deezerArtistId}%22&fmt=json") query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22https://www.deezer.com/artist/${deezerArtistId}%22&fmt=json")
count=$(echo "$query_data" | jq -r ".count") count=$(echo "$query_data" | jq -r ".count")
if [ "$count" == "0" ]; then if [ "$count" == "0" ]; then
sleep 2 sleep $musicbrainzSleep
query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22http://www.deezer.com/artist/${deezerArtistId}%22&fmt=json") query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22http://www.deezer.com/artist/${deezerArtistId}%22&fmt=json")
count=$(echo "$query_data" | jq -r ".count") count=$(echo "$query_data" | jq -r ".count")
sleep 2 sleep $musicbrainzSleep
fi fi
if [ "$count" == "0" ]; then if [ "$count" == "0" ]; then
query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22http://deezer.com/artist/${deezerArtistId}%22&fmt=json") query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22http://deezer.com/artist/${deezerArtistId}%22&fmt=json")
count=$(echo "$query_data" | jq -r ".count") count=$(echo "$query_data" | jq -r ".count")
sleep 2 sleep $musicbrainzSleep
fi fi
if [ "$count" == "0" ]; then if [ "$count" == "0" ]; then
@ -113,7 +114,7 @@ AddDeezerArtistToLidarr () {
if [ "$count" != "0" ]; then if [ "$count" != "0" ]; then
musicbrainz_main_artist_id=$(echo "$query_data" | jq -r '.urls[]."relation-list"[].relations[].artist.id' | head -n 1) musicbrainz_main_artist_id=$(echo "$query_data" | jq -r '.urls[]."relation-list"[].relations[].artist.id' | head -n 1)
sleep 2 sleep $musicbrainzSleep
artist_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/artist/$musicbrainz_main_artist_id?fmt=json") artist_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/artist/$musicbrainz_main_artist_id?fmt=json")
artist_sort_name="$(echo "$artist_data" | jq -r '."sort-name"')" artist_sort_name="$(echo "$artist_data" | jq -r '."sort-name"')"
artist_formed="$(echo "$artist_data" | jq -r '."begin-area".name')" artist_formed="$(echo "$artist_data" | jq -r '."begin-area".name')"
@ -208,7 +209,7 @@ LidarrTaskStatusCheck () {
alerted=yes alerted=yes
log "STATUS :: LIDARR BUSY :: Pausing/waiting for all active Lidarr tasks to end..." log "STATUS :: LIDARR BUSY :: Pausing/waiting for all active Lidarr tasks to end..."
fi fi
sleep 2 sleep $musicbrainzSleep
else else
break break
fi fi
@ -269,19 +270,19 @@ AddTidalArtistToLidarr () {
query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22https://listen.tidal.com/artist/${serviceArtistId}%22&fmt=json") query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22https://listen.tidal.com/artist/${serviceArtistId}%22&fmt=json")
count=$(echo "$query_data" | jq -r ".count") count=$(echo "$query_data" | jq -r ".count")
if [ "$count" == "0" ]; then if [ "$count" == "0" ]; then
sleep 2 sleep $musicbrainzSleep
query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22http://listen.tidal.com/artist/${serviceArtistId}%22&fmt=json") query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22http://listen.tidal.com/artist/${serviceArtistId}%22&fmt=json")
count=$(echo "$query_data" | jq -r ".count") count=$(echo "$query_data" | jq -r ".count")
fi fi
if [ "$count" == "0" ]; then if [ "$count" == "0" ]; then
sleep 2 sleep $musicbrainzSleep
query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22https://tidal.com/artist/${serviceArtistId}%22&fmt=json") query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22https://tidal.com/artist/${serviceArtistId}%22&fmt=json")
count=$(echo "$query_data" | jq -r ".count") count=$(echo "$query_data" | jq -r ".count")
fi fi
if [ "$count" == "0" ]; then if [ "$count" == "0" ]; then
sleep 2 sleep $musicbrainzSleep
query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22http://tidal.com/artist/${serviceArtistId}%22&fmt=json") query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22http://tidal.com/artist/${serviceArtistId}%22&fmt=json")
count=$(echo "$query_data" | jq -r ".count") count=$(echo "$query_data" | jq -r ".count")
fi fi

Loading…
Cancel
Save