Use album or artist picture when downloading

This commit is contained in:
M.B. Christiansen 2022-10-10 10:42:14 +02:00
parent 83ad18b0eb
commit 51fb3ec6d4
1 changed files with 4 additions and 1 deletions

5
kunst
View File

@ -114,7 +114,10 @@ get_cover_online() {
API_URL="https://api.deezer.com/search/autocomplete?q=$QUERY" && API_URL=${API_URL//' '/'%20'} API_URL="https://api.deezer.com/search/autocomplete?q=$QUERY" && API_URL=${API_URL//' '/'%20'}
echo $API_URL echo $API_URL
# Extract the albumcover from the json returned # 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 if [ "$IMG_URL" = '' ] || [ "$IMG_URL" = 'null' ];then
[ ! "$SILENT" ] && echo "error: cover not found online" [ ! "$SILENT" ] && echo "error: cover not found online"