Adds mpv radio block
This commit is contained in:
parent
782795779b
commit
707294cc42
3 changed files with 29 additions and 7 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
14
i3/blocks/mpvmediaplayer
Executable file
14
i3/blocks/mpvmediaplayer
Executable file
|
@ -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…
Add table
Add a link
Reference in a new issue