Update mprix and colors

This commit is contained in:
Hydroxycarbamide 2022-10-01 19:38:53 +02:00
parent b725dccade
commit e1aa18dbed
20 changed files with 389 additions and 85 deletions

View file

@ -1,3 +1,18 @@
get_artUrl() {
artUrl=$(playerctl -p $1 metadata | grep artUrl | awk '{$1=$2=""; print $0}')
regex='(https?|ftp)://[-[:alnum:]\+&@#/%?=~_|!:,.;]*[-[:alnum:]\+&@#/%=~_|]'
if [[ $artUrl =~ $regex ]]
then
filename=/tmp/spotify-mpris/$(basename $artUrl)
if [ ! -f $filename ]
then
curl -sSL $artUrl --create-dirs -o $filename
fi
echo $filename
else
echo $artUrl
fi
}
read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)"
declare -a PAUSED
@ -8,7 +23,7 @@ for player in "${PLAYERS[@]}"; do
# if we have one playing, we'll use it and EXIT
if [ "$p_status" = "Playing" ]; then
echo $(playerctl -p $player metadata | grep artUrl | awk '{$1=$2=""; print $0}')
get_artUrl $player
exit 0;
fi
@ -17,6 +32,7 @@ done
# if we have a paused, show it otherwise assume there are no players or have all stopped
if [ -n "${PAUSED[0]}" ]; then
echo $(playerctl -p ${PAUSED[0]} metadata | grep artUrl | awk '{$1=$2=""; print $0}')
get_artUrl ${PAUSED[0]}
echo $(playerctl -p metadata | grep artUrl | awk '{$1=$2=""; print $0}')
fi