From 335e56e4e76e5c09a245786309c841b604f0474a Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Wed, 6 Jul 2022 20:08:12 +0000 Subject: [PATCH] v1.0.83 - bug fix to check for previous imports when not using beets --- root/scripts/download.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/root/scripts/download.sh b/root/scripts/download.sh index 0cce04f..2bb5196 100644 --- a/root/scripts/download.sh +++ b/root/scripts/download.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.82" +scriptVersion="1.0.83" lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" if [ "$lidarrUrlBase" = "null" ]; then lidarrUrlBase="" @@ -1220,6 +1220,22 @@ CheckLidarrBeforeImport () { alreadyImported=true return fi + + lidarrAlbumData=$(curl -s --header "X-Api-Key:"${lidarrApiKey} --request GET "$lidarrUrl/api/v1/album/" | jq -r ".[] | select(.foreignAlbumId==\"$1\")") + lidarrCheckAlbumId=$(echo "$lidarrAlbumData" | jq -r ".id") + lidarrPercentOfTracks=$(echo "$lidarrAlbumData" | jq -r ".statistics.percentOfTracks") + + if [ "$lidarrPercentOfTracks" = "null" ]; then + lidarrPercentOfTracks=0 + return + fi + if [ $lidarrPercentOfTracks -gt 0 ]; then + if [ $wantedAlbumListSource = missing ]; then + log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: Already Imported Album (Missing), skipping..." + alreadyImported=true + return + fi + fi fi }