snowflake/home/programs/eww/config/scripts/get-music-cover.sh
notohh fa03a425ad
programs: add eww
i should settle on a bar xddd
2024-04-26 17:22:19 -04:00

21 lines
528 B
Bash

#!/usr/bin/env bash
COVER_PATH=$1
cd $COVER_PATH
IMGPATH="$COVER_PATH/music_cover.png"
playerctl -F metadata mpris:artUrl 2>/dev/null | while read -r COVER_URL; do
if [[ "$COVER_URL" = https* ]]; then
if [ ! -e "$COVER_PATH/$(basename "$COVER_URL")" ]; then
wget -N "$COVER_URL" -o /dev/null
fi
rm "$IMGPATH"
ln -s "$(basename "$COVER_URL")" "$IMGPATH"
echo "$IMGPATH"
elif [ "$COVER_URL" = "" ]; then
echo ""
else
echo "$COVER_URL"
fi
done