dotfiles/.config/waybar/album_art.sh
2023-11-13 21:17:35 +01:00

19 lines
426 B
Bash

#!/bin/bash
album_art=$(playerctl -p spotify metadata mpris:artUrl)
if [[ -z $album_art ]]
then
# spotify is dead, we should die too.
exit
fi
if [[ -f /tmp/cover.url ]]
then
old_album_art=$(cat /tmp/cover.url)
if [[ $old_album_art == $album_art ]]
then
echo "/tmp/cover.jpeg"
exit
fi
fi
curl -s "${album_art}" --output "/tmp/cover.jpeg"
echo ${album_art} > /tmp/cover.url
echo "/tmp/cover.jpeg"