From 51fb3ec6d494f384a4465e58f6017275b2e60744 Mon Sep 17 00:00:00 2001 From: "M.B. Christiansen" Date: Mon, 10 Oct 2022 10:42:14 +0200 Subject: [PATCH] Use album or artist picture when downloading --- kunst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kunst b/kunst index 7de826d..d33730c 100755 --- a/kunst +++ b/kunst @@ -114,7 +114,10 @@ get_cover_online() { API_URL="https://api.deezer.com/search/autocomplete?q=$QUERY" && API_URL=${API_URL//' '/'%20'} echo $API_URL # Extract the albumcover from the json returned - IMG_URL=$(curl -s "$API_URL" | jq -r '.playlists.data[0].picture_big') + JSON=$(curl -s "$API_URL") + ALBUM=$(echo "$JSON" | jq -r '.tracks.data[0].album.picture_big' | sed 's/null//'); + ARTIST=$(echo "$JSON" | jq -r '.tracks.data[0].artist.picture_big' | sed 's/null//'); + IMG_URL="${ALBUM:-$ARTIST}" if [ "$IMG_URL" = '' ] || [ "$IMG_URL" = 'null' ];then [ ! "$SILENT" ] && echo "error: cover not found online"