From 4b0dd8e5a653148ec29222ac942654d38fe12d58 Mon Sep 17 00:00:00 2001 From: milarin Date: Wed, 10 Jan 2024 19:30:48 +0100 Subject: [PATCH] added LoadFile command --- commands.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 commands.go diff --git a/commands.go b/commands.go new file mode 100644 index 0000000..78daf40 --- /dev/null +++ b/commands.go @@ -0,0 +1,19 @@ +package mpvipc + +type LoadFileFlag string + +const ( + LoadFileReplace LoadFileFlag = "replace" + LoadFileAppend LoadFileFlag = "append" + LoadFileAppendPlay LoadFileFlag = "append-play" +) + +func LoadFile(socket string, file string, flags LoadFileFlag) error { + if flags == "" { + flags = LoadFileReplace + } + + cmd := &Command{[]interface{}{"loadfile", file, flags}} + _, err := SendCommand[any](socket, cmd) + return err +}