~emersion/dotfiles

4f4a32ef4ad701ae3c079f798cf3bcf92959f0bc — Simon Ser 3 months ago 9da7bef
bin/stewdio: use mpv IPC instead of a FIFO
1 files changed, 5 insertions(+), 5 deletions(-)

M bin/stewdio
M bin/stewdio => bin/stewdio +5 -5
@@ 6,17 6,17 @@

case "$1" in
play|pause|stop)
	if [ -e "$XDG_RUNTIME_DIR/stewdio.fifo" ]; then
	socket="$XDG_RUNTIME_DIR/stewdio.socket"
	if [ -e "$socket" ]; then
		echo >&2 "Stopping playback"
		echo quit >"$XDG_RUNTIME_DIR/stewdio.fifo"
		echo '{"command": ["quit"]}' | ncat -U "$socket" >/dev/null
	else
		echo >&2 "Starting playback"
		mkfifo "$XDG_RUNTIME_DIR/stewdio.fifo"
		(
			mpv --input-file="$XDG_RUNTIME_DIR/stewdio.fifo" \
			mpv --input-ipc-server="$socket" \
				--no-audio-display --quiet \
				'http://radio.stew.moe/stream/stream128.opus?user='$USER
			rm "$XDG_RUNTIME_DIR/stewdio.fifo"
			rm "$socket"
		) >/dev/null </dev/null &
		disown
	fi