From e110737e5bff3f8afbfe876258e22c7ee7856dcd Mon Sep 17 00:00:00 2001 From: Richard Halford Date: Fri, 13 Aug 2021 18:32:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=83=20if=20mpv=20is=20already=20runnin?= =?UTF-8?q?g=20append=20selected=20video=20to=20playlist,=20otherwise=20st?= =?UTF-8?q?art=20mpv=20and=20play?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- subs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/subs b/subs index d39dd56..41bf58f 100755 --- a/subs +++ b/subs @@ -233,8 +233,12 @@ get_sel() { printf '%s\n' "$url" else printf 'playing: %s\n' "$url" - # shellcheck disable=2086 - exec mpv $MPV_OPTS "$url" + if [ "$(pidof mpv)" ] ; then + echo '{"command": ["loadfile", "'$url'", "append-play"]}' | socat - /tmp/mpvsocket + else + # shellcheck disable=2086 + exec mpv $MPV_OPTS --input-ipc-server=/tmp/mpvsocket "$url" + fi fi fi break