From 6df4e01ba137ab690b22316ace2797f292c77574 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Wed, 13 Jul 2022 12:16:19 -0400 Subject: [PATCH] v1.0.165 - Additonal improvements to "CheckLidarrBeforeImport" process --- root/scripts/download.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/root/scripts/download.sh b/root/scripts/download.sh index 738174f..2cf70b0 100644 --- a/root/scripts/download.sh +++ b/root/scripts/download.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.164" +scriptVersion="1.0.165" lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" if [ "$lidarrUrlBase" = "null" ]; then lidarrUrlBase="" @@ -2020,8 +2020,9 @@ CheckLidarrBeforeImport () { alreadyImported=false if [ "$2" = "beets" ]; then - checkLidarrAlbumData=$(curl -s --header "X-Api-Key:"${lidarrApiKey} --request GET "$lidarrUrl/api/v1/album/" | jq -r ".[] | select(.foreignAlbumId==\"$1\")") - checkLidarrAlbumPercentOfTracks=$(echo "$lidarrAlbumData" | jq -r ".statistics.percentOfTracks") + getLidarrAlbumId=$(curl -s "$lidarrUrl/api/v1/search?term=lidarr%3A$1&apikey=$lidarrApiKey" | jq -r .[].album.releases[].albumId | sort -u) + checkLidarrAlbumData="$(curl -s "$lidarrUrl/api/v1/album/$getLidarrAlbumId?apikey=${lidarrApiKey}")" + checkLidarrAlbumPercentOfTracks=$(echo "$checkLidarrAlbumData" | jq -r ".statistics.percentOfTracks") if [ "$checkLidarrAlbumPercentOfTracks" = "null" ]; then checkLidarrAlbumPercentOfTracks=0