summaryrefslogtreecommitdiff
path: root/bin/menuscripts/mmpv
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-01-05 16:56:42 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-01-05 16:56:42 +0100
commite6e98313b9769b431d8a66c0aac2b82295d2bf1e (patch)
tree1cdbc2075815fa88a0b80818174542e00a41f855 /bin/menuscripts/mmpv
parent541ab2e483efe77d08ae5d04119a834f24b6d150 (diff)
parent0d10205772b2745356969176de6f52510527e5a6 (diff)
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/menuscripts/mmpv')
-rwxr-xr-xbin/menuscripts/mmpv8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/menuscripts/mmpv b/bin/menuscripts/mmpv
new file mode 100755
index 0000000..76c0d6a
--- /dev/null
+++ b/bin/menuscripts/mmpv
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Have an mpv instance that works with a socket somewhat globally
+socket="/tmp/mpvsocket"
+# Start mpv in idle if socket is not getting listened to
+nc -zvU "$socket" || setsid mpv --input-ipc-server=/tmp/mpvsocket --idle &
+file="$(PLAYER='echo' mmedia video)"
+[ "$file" ] || exit 1
+echo '{ "command": ["loadfile", "'"$file"'", "append-play"] }' | nc -U /tmp/mpvsocket