Update mpris plugin with cover art
This commit is contained in:
parent
8d5ee408cf
commit
0ff84042ab
5 changed files with 145 additions and 27 deletions
22
bin/get_mpris_art.sh
Executable file
22
bin/get_mpris_art.sh
Executable file
|
@ -0,0 +1,22 @@
|
|||
|
||||
read -d'\n' -ra PLAYERS <<<"$(playerctl -l 2>/dev/null)"
|
||||
declare -a PAUSED
|
||||
for player in "${PLAYERS[@]}"; do
|
||||
[ "$player" = "playerctld" ] && continue;
|
||||
|
||||
p_status=$(playerctl -p "$player" status 2>/dev/null)
|
||||
|
||||
# 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}')
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
[ "$p_status" = "Paused" ] && PAUSED+=("$player")
|
||||
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}')
|
||||
fi
|
||||
|
|
@ -35,17 +35,17 @@ get_info() {
|
|||
|
||||
# if not "icon", display information and return
|
||||
if [ "$2" != "icon" ]; then
|
||||
printf "$title"
|
||||
artist=$(extract_meta artist)
|
||||
[ -z "$artist" ] && artist=$(extract_meta albumArtist)
|
||||
|
||||
if [ -n "$artist" ]; then
|
||||
album=$(extract_meta album)
|
||||
[ -n "$album" ] && echo -n " $album "
|
||||
[ -n "$album" ] && printf "\nfrom $album"
|
||||
|
||||
echo -n " ﴁ $artist "
|
||||
printf "\nby $artist"
|
||||
fi
|
||||
|
||||
echo "$title"
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue