dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit d2a040cdacfc825954a772e8a4176890539848f9
parent 9f2593f632d2171a30d916a78e6525b03de59b85
Author: Alex Balgavy <alex@balgavy.eu>
Date:   Tue,  1 Dec 2020 13:25:02 +0100

mpvq: fix queuing after deprecated input-file

mpv finally (to my frustration) removed the --input-file option. So I
had to rewrite everything to work with Unix domain sockets, which means
introducing a dependency on netcat with the -U flag (I think netcat-bsd
or something like that). I can't think of another way to do it at the
moment.


Former-commit-id: 3ebf5018b6824bf803816cb91caaa1a0de43fdb3
Diffstat:
Mscripts/mpvq | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/scripts/mpvq b/scripts/mpvq @@ -1,16 +1,18 @@ #!/bin/sh -if ! [ -p "$HOME"/.cache/mpv/input ]; then +if ! [ -S "$HOME"/.cache/mpv/input ]; then mkfifo "$HOME"/.cache/mpv/input fi # queue the video play() { if pgrep -f MPV-Q > /dev/null; then - printf "%s\n" "loadfile \"$1\" append-play" > "$HOME"/.cache/mpv/input + # TODO: unfortunate dependency on `nc`, try to find a way to send text to socket without dependencies + printf "loadfile \"%s\" append-play\n" "$1" | nc -U "$HOME"/.cache/mpv/input terminal-notifier -title "Video queued" -message "Added to queue successfully" -group "mpv" 1>/dev/null 2>&1 else terminal-notifier -title "Playing video" -message "MPV is launching..." -group "mpv" 1>/dev/null 2>&1 - mpv --idle=yes --volume=50 --no-terminal --x11-name=MPV-Q --input-file="$HOME"/.cache/mpv/input --player-operation-mode=pseudo-gui "$1" & + # This converts FIFO to a domain socket + mpv --idle=yes --volume=50 --no-terminal --x11-name=MPV-Q --input-ipc-server="$HOME"/.cache/mpv/input --player-operation-mode=pseudo-gui "$1" & fi }