From 1513ca8b71bf6261b5a8dc080b0be9fe62e9c64a Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Thu, 1 Jun 2023 19:37:27 -0400 Subject: [PATCH] 1.0.3 - reset agent to default, increase length between queries --- root/scripts/Video.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/root/scripts/Video.sh b/root/scripts/Video.sh index ed3319d..ce9536a 100644 --- a/root/scripts/Video.sh +++ b/root/scripts/Video.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.2" +scriptVersion="1.0.3" if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" @@ -13,8 +13,9 @@ if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then lidarrPort="$(cat /config/config.xml | xq | jq -r .Config.Port)" lidarrUrl="http://localhost:${lidarrPort}${lidarrUrlBase}" fi -agent="${lidarrAgentInstanceId} ( https://github.com/RandomNinjaAtk/docker-lidarr-extended )" +agent="lidarr-extended ( https://github.com/RandomNinjaAtk/docker-lidarr-extended )" musicbrainzMirror=https://musicbrainz.org +musicbrainzSleep=5 # Debugging Settings #addFeaturedVideoArtists=true @@ -113,7 +114,7 @@ CacheMusicbrainzRecords () { log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Processing..." log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Checking Musicbrainz for recordings..." musicbrainzArtistRecordings=$(curl -s -A "$agent" "$musicbrainzMirror/ws/2/recording?artist=$lidarrArtistMusicbrainzId&limit=1&offset=0&fmt=json") - sleep 2 + sleep $musicbrainzSleep musicbrainzArtistRecordingsCount=$(echo "$musicbrainzArtistRecordings" | jq -r '."recording-count"') log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: $musicbrainzArtistRecordingsCount recordings found..." @@ -161,7 +162,7 @@ CacheMusicbrainzRecords () { log "$processCount of $lidarrArtistIdsCount :: MBZDB :: $lidarrArtistName :: Downloading page $i... ($offset - $dlnumber Results)" curl -s -A "$agent" "$musicbrainzMirror/ws/2/recording?artist=$lidarrArtistMusicbrainzId&inc=artist-credits+url-rels+recording-rels+release-rels+release-group-rels&limit=100&offset=$offset&fmt=json" | jq -r ".recordings[]" >> "/config/extended/cache/musicbrainz/$lidarrArtistId--$lidarrArtistMusicbrainzId--recordings.json" - sleep 2 + sleep $musicbrainzSleep done fi } @@ -242,7 +243,7 @@ TidaldlStatusCheck () { if ps aux | grep "tidal-dl" | grep -v "grep" | read; then running=yes log "STATUS :: TIDAL-DL :: BUSY :: Pausing/waiting for all active tidal-dl tasks to end..." - sleep 2 + sleep $musicbrainzSleep continue fi break @@ -604,11 +605,11 @@ AddFeaturedVideoArtists () { fi log "$loopCount of $videoArtistsCount :: $artistName :: Processing url :: https://imvdb.com/n/$slug" query_data=$(curl -s -A "$agent" "https://musicbrainz.org/ws/2/url?query=url:%22https://imvdb.com/n/$slug%22&fmt=json") - sleep 2 + sleep $musicbrainzSleep count=$(echo "$query_data" | jq -r ".count") if [ "$count" != "0" ]; then musicbrainzArtistId="$(echo "$query_data" | jq -r ".urls[].\"relation-list\"[].relations[].artist.id")" - sleep 2 + sleep $musicbrainzSleep else log "$loopCount of $videoArtistsCount :: $artistName :: ERROR : Musicbrainz ID Not Found, skipping..." continue @@ -692,7 +693,7 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: IMVDB Slug Not Found..." log "$processCount of $lidarrArtistIdsCount :: $lidarrArtistName :: Fallback to Musicbrainz for IMVDB Slug" tempmbzartistinfo="$(curl -s -A "$agent" "$musicbrainzMirror/ws/2/artist/$lidarrArtistMusicbrainzId?inc=url-rels+genres&fmt=json")" - sleep 2 + sleep $musicbrainzSleep artistImvdbUrl="$(echo "$tempmbzartistinfo" | jq -r ".relations | .[] | .url | select(.resource | contains(\"imvdb\")) | .resource")" artistImvdbSlug=$(basename "$artistImvdbUrl") fi @@ -911,7 +912,7 @@ for lidarrArtistId in $(echo $lidarrArtistIds); do if [ "$count" != "0" ]; then featuredArtistName="$(echo "$query_data" | jq -r ".urls[].\"relation-list\"[].relations[].artist.name")" echo -n "$featuredArtistName" > /config/extended/cache/imvdb/$featuredArtistSlug - sleep 2 + sleep $musicbrainzSleep fi fi find /config/extended/cache/imvdb -type f -empty -delete # delete empty files