lib/mpv-slave/mpv.rb in mpv-slave-0.1 vs lib/mpv-slave/mpv.rb in mpv-slave-0.2
- old
+ new
@@ -10,10 +10,11 @@
@pid = Process.spawn(
"mpv",
"--idle",
"--really-quiet",
+ "--no-input-terminal",
"--input-unix-socket", socket,
)
puts "waiting for mpv to start up..."
until File.exists?(socket) or not running?
sleep 0.1
@@ -47,10 +48,14 @@
def add file
play file, mode: "append-play", wait: false
end
+ def pause
+ toggle "pause"
+ end
+
def get prop
command "get_property", prop
end
def set prop, value
@@ -83,9 +88,13 @@
enable_event "all"
end
def disable_events
disable_event "all"
+ end
+
+ def method_missing cmd, *args, &block
+ command cmd.to_s, *args, &block
end
def close
Process.kill :SIGTERM, @pid
Process.wait @pid