diff options
| author | Julian Hurst <ark@mansus.space> | 2023-09-03 16:03:20 +0200 |
|---|---|---|
| committer | Julian Hurst <ark@mansus.space> | 2023-09-03 16:03:20 +0200 |
| commit | 857b01a24136917b64d985932fd454ae081bd37c (patch) | |
| tree | e749598b2a030032f1af095ef323ba672c8a350b /mpv_scripts/syncpos.lua | |
| parent | 08ecf5d045ecdee6dff29729d228506b11a3749a (diff) | |
| download | mediasync-857b01a24136917b64d985932fd454ae081bd37c.tar.gz | |
mpv_scripts: add osd messages on success/error
Diffstat (limited to 'mpv_scripts/syncpos.lua')
| -rw-r--r-- | mpv_scripts/syncpos.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/mpv_scripts/syncpos.lua b/mpv_scripts/syncpos.lua index 57f002e..b40ea2c 100644 --- a/mpv_scripts/syncpos.lua +++ b/mpv_scripts/syncpos.lua @@ -12,11 +12,16 @@ function savepos() local host, port = "127.0.0.1", 6789 local socket = require("socket") local tcp = assert(socket.tcp()) - tcp:connect(host, port) + local c = tcp:connect(host, port) + if not c then + mp.osd_message("syncpos: Couldn't connect") + return + end local data = "save \"" .. name .. "\" " .. tpos .. "\n" print("sending: " .. data) tcp:send(data) tcp:close() + mp.osd_message("Saved position " .. tpos .. " to " .. name) end function getpos() @@ -27,7 +32,11 @@ function getpos() local host, port = "127.0.0.1", 6789 local socket = require("socket") local tcp = assert(socket.tcp()) - tcp:connect(host, port) + local c = tcp:connect(host, port) + if not c then + mp.osd_message("syncpos: Couldn't connect") + return + end local data = "get \"" .. name .. "\"\n" print("sending: " .. data) local newpos = "" @@ -39,6 +48,7 @@ function getpos() --print(status) --print(partial) mp.set_property("time-pos", newpos) + mp.osd_message("Got position " .. newpos .. " from " .. name) end mp.add_key_binding("X", "savepos", savepos) |
