From 53730b77df9d6983b72adfd5058dd45e125ed081 Mon Sep 17 00:00:00 2001 From: Makario1337 <74052988+Makario1337@users.noreply.github.com> Date: Fri, 9 Dec 2022 18:49:40 +0100 Subject: [PATCH 1/4] Removed leftovers of ArtisAdd Function Removed leftovers of ArtisAdd Function since this is a own script now --- root/scripts/Audio.sh | 50 +------------------------------------------ 1 file changed, 1 insertion(+), 49 deletions(-) diff --git a/root/scripts/Audio.sh b/root/scripts/Audio.sh index 50173be..1d2753b 100644 --- a/root/scripts/Audio.sh +++ b/root/scripts/Audio.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.301" +scriptVersion="1.0.302" if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" if [ "$lidarrUrlBase" == "null" ]; then @@ -1835,34 +1835,6 @@ LidarrTaskStatusCheck () { done } -LidarrMissingAlbumSearch () { - - log "Begin searching for missing artist albums via Lidarr Indexers..." - lidarrArtistIds=$(echo $lidarrMissingAlbumArtistsData | jq -r .id) - lidarrArtistIdsCount=$(echo "$lidarrArtistIds" | wc -l) - processCount=0 - for lidarrArtistId in $(echo $lidarrArtistIds); do - processCount=$(( $processCount + 1)) - lidarrArtistData=$(echo $lidarrMissingAlbumArtistsData | jq -r "select(.id==$lidarrArtistId)") - lidarrArtistName=$(echo $lidarrArtistData | jq -r .artistName) - lidarrArtistMusicbrainzId=$(echo $lidarrArtistData | jq -r .foreignArtistId) - if [ -d /config/extended/logs/searched/lidarr/artist ]; then - if [ -f /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId ]; then - log "$processCount of $lidarrArtistIdsCount :: Previously Notified Lidarr to search for \"$lidarrArtistName\" :: Skipping..." - continue - fi - fi - log "$processCount of $lidarrArtistIdsCount :: Notified Lidarr to search for \"$lidarrArtistName\"" - startLidarrArtistSearch=$(curl -s "$lidarrUrl/api/v1/command" -X POST -H "Content-Type: application/json" -H "X-Api-Key: $lidarrApiKey" --data-raw "{\"name\":\"ArtistSearch\",\"artistId\":$lidarrArtistId}") - if [ ! -d /config/extended/logs/searched/lidarr/artist ]; then - mkdir -p /config/extended/logs/searched/lidarr/artist - chmod -R 777 /config/extended/logs/searched/lidarr/artist - fi - touch /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId - chmod 777 /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId - done -} - function levenshtein { if [ "$1" == "$2" ]; then echo 0 @@ -1937,22 +1909,6 @@ if [ "$dlClientSource" == "tidal" ] || [ "$dlClientSource" == "both" ]; then TidalClientSetup fi -if [ "$addDeezerTopArtists" == "true" ]; then - AddDeezerTopArtists "$topLimit" -fi - -if [ "$addDeezerTopAlbumArtists" == "true" ]; then - AddDeezerTopAlbumArtists "$topLimit" -fi - -if [ "$addDeezerTopTrackArtists" == "true" ]; then - AddDeezerTopTrackArtists "$topLimit" -fi - -if [ "$addRelatedArtists" == "true" ]; then - AddRelatedArtists -fi - # Get artist list for LidarrMissingAlbumSearch process, to prevent searching for artists that will not be processed by the script lidarrMissingAlbumArtistsData=$(wget --timeout=0 -q -O - "$lidarrUrl/api/v1/artist?apikey=$lidarrApiKey" | jq -r .[]) @@ -1964,9 +1920,5 @@ else log "ERROR :: dlClientSource set as: \"$dlClientSource\"" fi -if [ "$addDeezerTopArtists" == "true" ] || [ "$addDeezerTopAlbumArtists" == "true" ] || [ "$addDeezerTopTrackArtists" == "true" ] || [ "$addRelatedArtists" == "true" ]; then - LidarrMissingAlbumSearch -fi - log "Script end..." exit From b5c339a9c00521f4d61f391a233adad8bfa1c119 Mon Sep 17 00:00:00 2001 From: Makario1337 <74052988+Makario1337@users.noreply.github.com> Date: Fri, 9 Dec 2022 18:50:18 +0100 Subject: [PATCH 2/4] Moved leftover from audio to AutoArtistAdder Moved leftover from audio to AutoArtistAdder --- root/scripts/AutoArtistAdder.bash | 34 ++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/root/scripts/AutoArtistAdder.bash b/root/scripts/AutoArtistAdder.bash index 701b50a..048d56f 100644 --- a/root/scripts/AutoArtistAdder.bash +++ b/root/scripts/AutoArtistAdder.bash @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.006" +scriptVersion="1.0.007" if [ -z "$lidarrUrl" ] || [ -z "$lidarrApiKey" ]; then lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" if [ "$lidarrUrlBase" == "null" ]; then @@ -317,6 +317,34 @@ AddTidalArtistToLidarr () { done } +LidarrMissingAlbumSearch () { + + log "Begin searching for missing artist albums via Lidarr Indexers..." + lidarrArtistIds=$(echo $lidarrMissingAlbumArtistsData | jq -r .id) + lidarrArtistIdsCount=$(echo "$lidarrArtistIds" | wc -l) + processCount=0 + for lidarrArtistId in $(echo $lidarrArtistIds); do + processCount=$(( $processCount + 1)) + lidarrArtistData=$(echo $lidarrMissingAlbumArtistsData | jq -r "select(.id==$lidarrArtistId)") + lidarrArtistName=$(echo $lidarrArtistData | jq -r .artistName) + lidarrArtistMusicbrainzId=$(echo $lidarrArtistData | jq -r .foreignArtistId) + if [ -d /config/extended/logs/searched/lidarr/artist ]; then + if [ -f /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId ]; then + log "$processCount of $lidarrArtistIdsCount :: Previously Notified Lidarr to search for \"$lidarrArtistName\" :: Skipping..." + continue + fi + fi + log "$processCount of $lidarrArtistIdsCount :: Notified Lidarr to search for \"$lidarrArtistName\"" + startLidarrArtistSearch=$(curl -s "$lidarrUrl/api/v1/command" -X POST -H "Content-Type: application/json" -H "X-Api-Key: $lidarrApiKey" --data-raw "{\"name\":\"ArtistSearch\",\"artistId\":$lidarrArtistId}") + if [ ! -d /config/extended/logs/searched/lidarr/artist ]; then + mkdir -p /config/extended/logs/searched/lidarr/artist + chmod -R 777 /config/extended/logs/searched/lidarr/artist + fi + touch /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId + chmod 777 /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId + done +} + if [ -z $lidarrSearchForMissing ]; then lidarrSearchForMissing=true fi @@ -338,4 +366,8 @@ if [ "$addRelatedArtists" == "true" ]; then AddTidalRelatedArtists fi +if [ "$addDeezerTopArtists" == "true" ] || [ "$addDeezerTopAlbumArtists" == "true" ] || [ "$addDeezerTopTrackArtists" == "true" ] || [ "$addRelatedArtists" == "true" ]; then + LidarrMissingAlbumSearch +fi + exit From 88aee7aa08140ecb5241bd4b8e89e458517d9f05 Mon Sep 17 00:00:00 2001 From: Makario1337 <74052988+Makario1337@users.noreply.github.com> Date: Fri, 9 Dec 2022 18:56:16 +0100 Subject: [PATCH 3/4] Adjustment --- root/scripts/AutoArtistAdder.bash | 32 ------------------------------- 1 file changed, 32 deletions(-) diff --git a/root/scripts/AutoArtistAdder.bash b/root/scripts/AutoArtistAdder.bash index 048d56f..434dbf9 100644 --- a/root/scripts/AutoArtistAdder.bash +++ b/root/scripts/AutoArtistAdder.bash @@ -317,34 +317,6 @@ AddTidalArtistToLidarr () { done } -LidarrMissingAlbumSearch () { - - log "Begin searching for missing artist albums via Lidarr Indexers..." - lidarrArtistIds=$(echo $lidarrMissingAlbumArtistsData | jq -r .id) - lidarrArtistIdsCount=$(echo "$lidarrArtistIds" | wc -l) - processCount=0 - for lidarrArtistId in $(echo $lidarrArtistIds); do - processCount=$(( $processCount + 1)) - lidarrArtistData=$(echo $lidarrMissingAlbumArtistsData | jq -r "select(.id==$lidarrArtistId)") - lidarrArtistName=$(echo $lidarrArtistData | jq -r .artistName) - lidarrArtistMusicbrainzId=$(echo $lidarrArtistData | jq -r .foreignArtistId) - if [ -d /config/extended/logs/searched/lidarr/artist ]; then - if [ -f /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId ]; then - log "$processCount of $lidarrArtistIdsCount :: Previously Notified Lidarr to search for \"$lidarrArtistName\" :: Skipping..." - continue - fi - fi - log "$processCount of $lidarrArtistIdsCount :: Notified Lidarr to search for \"$lidarrArtistName\"" - startLidarrArtistSearch=$(curl -s "$lidarrUrl/api/v1/command" -X POST -H "Content-Type: application/json" -H "X-Api-Key: $lidarrApiKey" --data-raw "{\"name\":\"ArtistSearch\",\"artistId\":$lidarrArtistId}") - if [ ! -d /config/extended/logs/searched/lidarr/artist ]; then - mkdir -p /config/extended/logs/searched/lidarr/artist - chmod -R 777 /config/extended/logs/searched/lidarr/artist - fi - touch /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId - chmod 777 /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId - done -} - if [ -z $lidarrSearchForMissing ]; then lidarrSearchForMissing=true fi @@ -366,8 +338,4 @@ if [ "$addRelatedArtists" == "true" ]; then AddTidalRelatedArtists fi -if [ "$addDeezerTopArtists" == "true" ] || [ "$addDeezerTopAlbumArtists" == "true" ] || [ "$addDeezerTopTrackArtists" == "true" ] || [ "$addRelatedArtists" == "true" ]; then - LidarrMissingAlbumSearch -fi - exit From b4050f38368c6cdb7bfc638118d1829d2a29de03 Mon Sep 17 00:00:00 2001 From: Makario1337 <74052988+Makario1337@users.noreply.github.com> Date: Fri, 9 Dec 2022 18:56:42 +0100 Subject: [PATCH 4/4] Adjustment --- root/scripts/Audio.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/root/scripts/Audio.sh b/root/scripts/Audio.sh index 1d2753b..d8fcbde 100644 --- a/root/scripts/Audio.sh +++ b/root/scripts/Audio.sh @@ -1835,6 +1835,34 @@ LidarrTaskStatusCheck () { done } +LidarrMissingAlbumSearch () { + + log "Begin searching for missing artist albums via Lidarr Indexers..." + lidarrArtistIds=$(echo $lidarrMissingAlbumArtistsData | jq -r .id) + lidarrArtistIdsCount=$(echo "$lidarrArtistIds" | wc -l) + processCount=0 + for lidarrArtistId in $(echo $lidarrArtistIds); do + processCount=$(( $processCount + 1)) + lidarrArtistData=$(echo $lidarrMissingAlbumArtistsData | jq -r "select(.id==$lidarrArtistId)") + lidarrArtistName=$(echo $lidarrArtistData | jq -r .artistName) + lidarrArtistMusicbrainzId=$(echo $lidarrArtistData | jq -r .foreignArtistId) + if [ -d /config/extended/logs/searched/lidarr/artist ]; then + if [ -f /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId ]; then + log "$processCount of $lidarrArtistIdsCount :: Previously Notified Lidarr to search for \"$lidarrArtistName\" :: Skipping..." + continue + fi + fi + log "$processCount of $lidarrArtistIdsCount :: Notified Lidarr to search for \"$lidarrArtistName\"" + startLidarrArtistSearch=$(curl -s "$lidarrUrl/api/v1/command" -X POST -H "Content-Type: application/json" -H "X-Api-Key: $lidarrApiKey" --data-raw "{\"name\":\"ArtistSearch\",\"artistId\":$lidarrArtistId}") + if [ ! -d /config/extended/logs/searched/lidarr/artist ]; then + mkdir -p /config/extended/logs/searched/lidarr/artist + chmod -R 777 /config/extended/logs/searched/lidarr/artist + fi + touch /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId + chmod 777 /config/extended/logs/searched/lidarr/artist/$lidarrArtistMusicbrainzId + done +} + function levenshtein { if [ "$1" == "$2" ]; then echo 0 @@ -1920,5 +1948,9 @@ else log "ERROR :: dlClientSource set as: \"$dlClientSource\"" fi +if [ "$addDeezerTopArtists" == "true" ] || [ "$addDeezerTopAlbumArtists" == "true" ] || [ "$addDeezerTopTrackArtists" == "true" ] || [ "$addRelatedArtists" == "true" ]; then + LidarrMissingAlbumSearch +fi + log "Script end..." exit