From 7f584f68bfc1813383abc5d6da0579dbbf3b3471 Mon Sep 17 00:00:00 2001 From: ChrisK2 Date: Mon, 29 Dec 2014 18:26:22 +0100 Subject: OSC: add osc-message script command (wip) --- DOCS/man/osc.rst | 4 ++++ player/lua/osc.lua | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/DOCS/man/osc.rst b/DOCS/man/osc.rst index d197715f29..2bfbb40d27 100644 --- a/DOCS/man/osc.rst +++ b/DOCS/man/osc.rst @@ -246,6 +246,10 @@ in ``input.conf``, or sent by other scripts. ``disable-osc`` Hide the OSC permanently. This is also what the ``del`` key does. +``osc-message`` + Show a message on screen using the OSC. First argument is the message, + second the duration in seconds. + Example diff --git a/player/lua/osc.lua b/player/lua/osc.lua index e812e9131d..0b3126282e 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -588,8 +588,11 @@ end function show_message(text, duration) + --print("text: "..text.." duration: " .. duration) if duration == nil then duration = tonumber(mp.get_property("options/osd-duration")) / 1000 + elseif not type(duration) == "number" then + print("duration: " .. duration) end -- cut the text short, otherwise the following functions @@ -1926,6 +1929,8 @@ mp.register_event("tracks-changed", request_init) mp.register_script_message("enable-osc", function() enable_osc(true) end) mp.register_script_message("disable-osc", function() enable_osc(false) end) +mp.register_script_message("osc-message", show_message) + mp.observe_property("fullscreen", "bool", function(name, val) state.fullscreen = val -- cgit v1.2.3