From 68a08a27fa0a2069b38e7949350a91184f5d92b1 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Tue, 21 Jun 2022 19:01:54 +0000 Subject: [PATCH] 1.0.0046 - bug fix for artist links with 0 albums --- root/scripts/download.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/root/scripts/download.sh b/root/scripts/download.sh index dda3e76..433b88d 100644 --- a/root/scripts/download.sh +++ b/root/scripts/download.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.0045" +scriptVersion="1.0.0046" lidarrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" if [ "$lidarrUrlBase" = "null" ]; then lidarrUrlBase="" @@ -218,11 +218,15 @@ DArtistAlbumList () { albumcount="$(python3 /config/extended/scripts/discography.py "$1" | sort -u | wc -l)" - log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Searching for All Albums...." - log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $albumcount Albums found!" + log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: Searching for \"$1\" All Albums...." + if [ $albumcount -gt 0 ]; then + log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: $albumcount Albums found!" + else + log ":: $processNumber of $wantedListAlbumTotal :: $lidarrArtistNameSanitized :: $lidarrAlbumTitle :: ERROR :: $albumcount Albums found, skipping..." + return + fi albumids=($(python3 /config/extended/scripts/discography.py "$1" | sort -u)) - - + for id in ${!albumids[@]}; do currentprocess=$(( $id + 1 )) albumid="${albumids[$id]}" @@ -278,6 +282,7 @@ DArtistAlbumList () { echo "]" >> /config/extended/cache/deezer/$1-albums.json rm /config/extended/cache/deezer/$1-albums-temp.json fi + } TidalClientSetup () { @@ -763,6 +768,9 @@ SearchProcess () { if [ "$skipDeezer" = "false" ]; then for dId in ${!deezeArtistIds[@]}; do deezeArtistId="${deezeArtistIds[$dId]}" + if [ ! -f "/config/extended/cache/deezer/$deezeArtistId-albums.json" ]; then + continue + fi deezerArtistAlbumsData=$(cat "/config/extended/cache/deezer/$deezeArtistId-albums.json" | jq -r "sort_by(.nb_tracks) | sort_by(.explicit_lyrics) | reverse | .[]") deezerArtistAlbumsIds=($(echo "${deezerArtistAlbumsData}" | jq -r "select(.explicit_lyrics=="true") | select(.title | test(\"^$lidarrAlbumTitleFirstWord\";\"i\")) | .id")) @@ -843,6 +851,9 @@ SearchProcess () { if [ "$skipDeezer" = "false" ]; then for dId in ${!deezeArtistIds[@]}; do deezeArtistId="${deezeArtistIds[$dId]}" + if [ ! -f "/config/extended/cache/deezer/$deezeArtistId-albums.json" ]; then + continue + fi deezerArtistAlbumsData=$(cat "/config/extended/cache/deezer/$deezeArtistId-albums.json" | jq -r "sort_by(.release_date) | sort_by(.explicit_lyrics) | reverse | .[]") deezerArtistAlbumsIds=($(echo "${deezerArtistAlbumsData}" | jq -r "select(.explicit_lyrics=="false") | select(.title | test(\"^$lidarrAlbumTitleFirstWord\";\"i\")) | .id"))