commit 4d4a7fe9f7dd9ef42502f04b0ab30dc8d30ce20f parent 1606df2e67892353c0330c673ebc197d789eacaa Author: hhvn <dev@hhvn.uk> Date: Tue, 13 Apr 2021 21:17:47 +0100 .s/b/mpvms: handle files with IFS characters Diffstat:
M | .scripts/bin/mpvms | | | 12 | ++++++++++-- |
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/.scripts/bin/mpvms b/.scripts/bin/mpvms @@ -5,10 +5,18 @@ shift hmpv pause /tmp/mpv-socket herbe "Playing video(s): $@" & - mpv --input-ipc-server=/tmp/mpv-socket2 -- $@ || herbe "Failed to play video(s): $@" + while [ $# -ne 0 ] + do + printf "%s\0" "$1" + shift + done | xargs -0 mpv --input-ipc-server=/tmp/mpv-socket2 -- || herbe "Failed to play video(s): $@" exit } || { herbe "Playing music: $@" & - mpv --input-ipc-server=/tmp/mpv-socket --no-video -- $@ || herbe "Failed to play music: $@" + while [ $# -ne 0 ] + do + printf "%s\0" "$1" + shift + done | xargs -0 mpv --input-ipc-server=/tmp/mpv-socket --no-video -- || herbe "Failed to play music: $@" exit }