Hello mpv lovers, I 've just discovered this program or script if you which that controls mpv by the command line just like mpc does with mpd.
mpvc will control mpv as soon as you edit your .config/mpv/mpv.conf file by adding:
input-ipc-server=/tmp/mpvsocket
And for those who want to fit in your polybar here is a dirty script:
#!/bin/sh
if [[ $(pidof mpv) ]]; then
METADATA=$(echo '{ "command": ["get_property", "media-title"] }' | socat - /tmp/mpvsocket | awk -F '"' '{print $4}')
echo "$METADATA"
else
exit
fi
Now if you use youtube-viewer, modify the mpv player arguments by changing at line 84:
arg => "--really-quiet --title=*TITLE* --no-ytdl",
#With
arg => "--really-quiet --media-title=*TITLE* --no-ytdl",
Now polybar module:
[module/mpv]
type = custom/script
exec = your script path
tail = true
label = %output%
label-maxlen = 70
label-padding = 1
label-foreground = ${colors.yellow2}
format = <label>
format-prefix = " "
format-prefix-foreground = ${colors.foreground}
format-padding = 1
Hope you’ll like it.