Adds mpv radio block

master
Jonathan Hodgson 6 years ago
parent c1dd29f84d
commit 2afb901060
  1. 10
      i3/blocks/mediaplayer
  2. 14
      i3/blocks/mpvmediaplayer
  3. 12
      i3/i3blocks.conf

@ -10,16 +10,16 @@ case $BLOCK_BUTTON in
esac esac
if [ "$($COMMAND status)" = "Playing" ]; then if [ "$($COMMAND status 2> /dev/null )" = "Playing" ]; then
colour="#00FF00" colour="#00FF00"
else else
colour="#FF8000" colour="#FF8000"
fi fi
title=$($COMMAND metadata title | sed "s/\&/\&/g") title=$($COMMAND metadata title 2> /dev/null | sed "s/\&/\&/g")
artist=$($COMMAND metadata artist | sed "s/\&/\&/g") artist=$($COMMAND metadata artist 2> /dev/null | sed "s/\&/\&/g")
if [ "$title" != "(null)" ]; then if [ "$title" != "" ]; then
ret="<span foreground='$colour'>$title</span>" ret="<span foreground='$colour'>$title</span>"
if [ -n "$artist" ]; then if [ -n "$artist" ]; then
ret="$ret - $artist" ret="$ret - $artist"
@ -28,5 +28,3 @@ if [ "$title" != "(null)" ]; then
echo "$ret"; echo "$ret";
fi fi

@ -0,0 +1,14 @@
#!/usr/bin/sh
socket="${SOCKET:-/tmp/mpvsocket}"
#case $BLOCK_BUTTON in
# 1) $COMMAND previous ;;
# 3) $COMMAND next ;;
#esac
echo '{ "command": ["get_property_string", "filtered-metadata"] }' | socat - /tmp/mpvsocket | jq '.data' | sed 's/"{\\"icy-title\\":\\"//g' | sed 's/\\"}"//g'
echo ""
echo "#00FF00"

@ -59,10 +59,20 @@ interval=5
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others. # Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
[mediaplayer] [mediaplayer]
command=~/.dotfiles/i3/blocks/mediaplayer command=~/.dotfiles/i3/blocks/mediaplayer
instance=spotify
interval=2 interval=2
signal=10 signal=10
markup=pango markup=pango
#separator=false
# MPV Player
#
# This displays "ARTIST - SONG" if a music is playing.
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
[mpvmediaplayer]
command=~/.dotfiles/i3/blocks/mpvmediaplayer
SOCKET=/tmp/mpvsocket
interval=2
#markup=pango
#[proftpstatus] #[proftpstatus]
#command=~/.dotfiles/i3/blocks/proftp #command=~/.dotfiles/i3/blocks/proftp

Loading…
Cancel
Save