bug fixes

This commit is contained in:
RandomNinjaAtk 2023-07-10 13:47:10 +00:00 committed by GitHub
parent 031cebd6e3
commit 0532afe589
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
scriptVersion="1.1" scriptVersion="1.2"
# Settings # Settings
addFeaturedVideoArtists="true" addFeaturedVideoArtists="true"
@ -54,9 +54,9 @@ fi
verifyApiAccess () { verifyApiAccess () {
until false until false
do do
lidarrTest=$(wget --timeout=0 -q -O - "$lidarrUrl/api/v1/system/status?apikey=${lidarrApiKey}" | jq -r .appName) lidarrTest=$(wget --timeout=0 -q -O - "$arrUrl/api/v1/system/status?apikey=${arrApiKey}" | jq -r .appName)
if [ "$lidarrTest" == "Lidarr" ]; then if [ "$lidarrTest" == "Lidarr" ]; then
lidarrVersion=$(wget --timeout=0 -q -O - "$lidarrUrl/api/v1/system/status?apikey=${lidarrApiKey}" | jq -r .version) lidarrVersion=$(wget --timeout=0 -q -O - "$arrUrl/api/v1/system/status?apikey=${arrApiKey}" | jq -r .version)
log "Lidarr Version: $lidarrVersion" log "Lidarr Version: $lidarrVersion"
break break
else else
@ -443,7 +443,7 @@ LidarrTaskStatusCheck () {
alerted=no alerted=no
until false until false
do do
taskCount=$(curl -s "$lidarrUrl/api/v1/command?apikey=${lidarrApiKey}" | jq -r '.[] | select(.status=="started") | .name' | wc -l) taskCount=$(curl -s "$arrUrl/api/v1/command?apikey=${arrApiKey}" | jq -r '.[] | select(.status=="started") | .name' | wc -l)
if [ "$taskCount" -ge "1" ]; then if [ "$taskCount" -ge "1" ]; then
if [ "$alerted" = "no" ]; then if [ "$alerted" = "no" ]; then
alerted=yes alerted=yes
@ -466,7 +466,7 @@ AddFeaturedVideoArtists () {
log "-----------------------------------------------------------------------------" log "-----------------------------------------------------------------------------"
log "Add Featured Music Video Artists to Lidarr :: ENABLED" log "Add Featured Music Video Artists to Lidarr :: ENABLED"
log "-----------------------------------------------------------------------------" log "-----------------------------------------------------------------------------"
lidarrArtistsData="$(curl -s "$lidarrUrl/api/v1/artist?apikey=${lidarrApiKey}" | jq -r ".[]")" lidarrArtistsData="$(curl -s "$arrUrl/api/v1/artist?apikey=${arrApiKey}" | jq -r ".[]")"
artistImvdbUrl=$(echo $lidarrArtistsData | jq -r '.links[] | select(.name=="imvdb") | .url') artistImvdbUrl=$(echo $lidarrArtistsData | jq -r '.links[] | select(.name=="imvdb") | .url')
videoArtists=$(ls /config/extended/cache/imvdb/ | grep -Ev ".*--.*") videoArtists=$(ls /config/extended/cache/imvdb/ | grep -Ev ".*--.*")
videoArtistsCount=$(ls /config/extended/cache/imvdb/ | grep -Ev ".*--.*" | wc -l) videoArtistsCount=$(ls /config/extended/cache/imvdb/ | grep -Ev ".*--.*" | wc -l)
@ -485,7 +485,7 @@ AddFeaturedVideoArtists () {
log "$loopCount of $videoArtistsCount :: $artistName :: Processing url :: https://imvdb.com/n/$slug" log "$loopCount of $videoArtistsCount :: $artistName :: Processing url :: https://imvdb.com/n/$slug"
artistNameEncoded="$(jq -R -r @uri <<<"$artistName")" artistNameEncoded="$(jq -R -r @uri <<<"$artistName")"
lidarrArtistSearchData="$(curl -s "$lidarrUrl/api/v1/search?term=${artistNameEncoded}&apikey=${lidarrApiKey}")" lidarrArtistSearchData="$(curl -s "$arrUrl/api/v1/search?term=${artistNameEncoded}&apikey=${arrApiKey}")"
lidarrArtistMatchedData=$(echo $lidarrArtistSearchData | jq -r ".[] | select(.artist) | select(.artist.links[].url | contains (\"imvdb.com/n/${slug}\"))" 2>/dev/null) lidarrArtistMatchedData=$(echo $lidarrArtistSearchData | jq -r ".[] | select(.artist) | select(.artist.links[].url | contains (\"imvdb.com/n/${slug}\"))" 2>/dev/null)
if [ ! -z "$lidarrArtistMatchedData" ]; then if [ ! -z "$lidarrArtistMatchedData" ]; then
@ -496,7 +496,7 @@ AddFeaturedVideoArtists () {
log "$loopCount of $videoArtistsCount :: $artistName :: ERROR : Musicbrainz ID Not Found, skipping..." log "$loopCount of $videoArtistsCount :: $artistName :: ERROR : Musicbrainz ID Not Found, skipping..."
continue continue
fi fi
data=$(curl -s "$lidarrUrl/api/v1/rootFolder" -H "X-Api-Key: $lidarrApiKey" | jq -r ".[]") data=$(curl -s "$arrUrl/api/v1/rootFolder" -H "X-Api-Key: $arrApiKey" | jq -r ".[]")
path="$(echo "$data" | jq -r ".path")" path="$(echo "$data" | jq -r ".path")"
qualityProfileId="$(echo "$data" | jq -r ".defaultQualityProfileId")" qualityProfileId="$(echo "$data" | jq -r ".defaultQualityProfileId")"
metadataProfileId="$(echo "$data" | jq -r ".defaultMetadataProfileId")" metadataProfileId="$(echo "$data" | jq -r ".defaultMetadataProfileId")"
@ -517,7 +517,7 @@ AddFeaturedVideoArtists () {
fi fi
log "$loopCount of $videoArtistsCount :: $artistName :: Adding $artistName to Lidarr ($foreignId)..." log "$loopCount of $videoArtistsCount :: $artistName :: Adding $artistName to Lidarr ($foreignId)..."
LidarrTaskStatusCheck LidarrTaskStatusCheck
lidarrAddArtist=$(curl -s "$lidarrUrl/api/v1/artist" -X POST -H 'Content-Type: application/json' -H "X-Api-Key: $lidarrApiKey" --data-raw "$data") lidarrAddArtist=$(curl -s "$arrUrl/api/v1/artist" -X POST -H 'Content-Type: application/json' -H "X-Api-Key: $arrApiKey" --data-raw "$data")
done done
} }
@ -539,17 +539,17 @@ VideoProcess () {
log "Finding Videos" log "Finding Videos"
log "-----------------------------------------------------------------------------" log "-----------------------------------------------------------------------------"
if [ -z "$videoDownloadTag" ]; then if [ -z "$videoDownloadTag" ]; then
lidarrArtists=$(wget --timeout=0 -q -O - "$lidarrUrl/api/v1/artist?apikey=$lidarrApiKey" | jq -r .[]) lidarrArtists=$(wget --timeout=0 -q -O - "$arrUrl/api/v1/artist?apikey=$arrApiKey" | jq -r .[])
lidarrArtistIds=$(echo $lidarrArtists | jq -r .id) lidarrArtistIds=$(echo $lidarrArtists | jq -r .id)
else else
lidarrArtists=$(curl -s "$lidarrUrl/api/v1/tag/detail" -H 'Content-Type: application/json' -H "X-Api-Key: $lidarrApiKey" | jq -r -M ".[] | select(.label == \"$videoDownloadTag\") | .artistIds") lidarrArtists=$(curl -s "$arrUrl/api/v1/tag/detail" -H 'Content-Type: application/json' -H "X-Api-Key: $arrApiKey" | jq -r -M ".[] | select(.label == \"$videoDownloadTag\") | .artistIds")
lidarrArtistIds=$(echo $lidarrArtists | jq -r .[]) lidarrArtistIds=$(echo $lidarrArtists | jq -r .[])
fi fi
lidarrArtistIdsCount=$(echo "$lidarrArtistIds" | wc -l) lidarrArtistIdsCount=$(echo "$lidarrArtistIds" | wc -l)
processCount=0 processCount=0
for lidarrArtistId in $(echo $lidarrArtistIds); do for lidarrArtistId in $(echo $lidarrArtistIds); do
processCount=$(( $processCount + 1)) processCount=$(( $processCount + 1))
lidarrArtistData=$(wget --timeout=0 -q -O - "$lidarrUrl/api/v1/artist/$lidarrArtistId?apikey=$lidarrApiKey") lidarrArtistData=$(wget --timeout=0 -q -O - "$arrUrl/api/v1/artist/$lidarrArtistId?apikey=$arrApiKey")
lidarrArtistName=$(echo $lidarrArtistData | jq -r .artistName) lidarrArtistName=$(echo $lidarrArtistData | jq -r .artistName)
lidarrArtistMusicbrainzId=$(echo $lidarrArtistData | jq -r .foreignArtistId) lidarrArtistMusicbrainzId=$(echo $lidarrArtistData | jq -r .foreignArtistId)