Advertisement
constantin-net

mpv_crop_test.lua

Jul 2nd, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. capture = {}
  2. local gp
  3. if mp.get_property == nil then
  4.     gp = mp.property_get
  5. else
  6.     gp = mp.get_property
  7. end
  8. function capture.handler()
  9.     local c = capture
  10.     local x, y = mp.get_mouse_pos()
  11.     if c.trig then
  12.         mp.commandv("show-text", string.format("координаты 2 x=%d ; y=%d", x, y))
  13.         local f = assert(io.open("/tmp/webm_crop2", "w"))
  14.         f:write(string.format("%d:%d", x, y))
  15.         f:close()
  16.         c.trig = nil
  17.     else
  18.         mp.commandv("show-text", string.format("координаты 1 x=%d ; y=%d", x, y))
  19.         local f = assert(io.open("/tmp/webm_crop1", "w"))
  20.         f:write(string.format("%d:%d", x, y))
  21.         f:close()
  22.         c.trig = 1
  23.     end
  24. end
  25. mp.add_forced_key_binding("F10", capture.handler)
  26. if bindings_enabled then toggle_bindings(true, true) end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement