<html><head></head><body><div class="gmail_quote">Le 3 août 2017 16:10:53 GMT+03:00, "Hugo Beauzée-Luyssen" <hugo@beauzee.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">From: Thomas Guillem <thomas@gllm.fr><br /><br />---<br /> modules/lua/libs/misc.c      | 9 +++++++++<br /> share/lua/README.txt         | 1 +<br /> share/lua/modules/common.lua | 7 +++++--<br /> 3 files changed, 15 insertions(+), 2 deletions(-)<br /><br />diff --git a/modules/lua/libs/misc.c b/modules/lua/libs/misc.c<br />index a0472e82a2..36ca4137d7 100644<br />--- a/modules/lua/libs/misc.c<br />+++ b/modules/lua/libs/misc.c<br />@@ -154,6 +154,14 @@ static int vlclua_action_id( lua_State *L )<br />     return 1;<br /> }<br /> <br />+static int vlclua_action_do( lua_State *L )<br />+{<br />+    vlc_object_t *p_this = vlclua_get_this( L );<br />+    int i_ret = vlc_actions_do( p_this, luaL_checkint( L, 1 ),<br />+                                luaL_checkboolean( L, 2 ) );<br />+    return vlclua_push_ret( L, i_ret );<br />+}<br />+<br /> /*****************************************************************************<br />  *<br />  *****************************************************************************/<br />@@ -163,6 +171,7 @@ static const luaL_Reg vlclua_misc_reg[] = {<br />     { "license", vlclua_license },<br /> <br />     { "action_id", vlclua_action_id },<br />+    { "action_do", vlclua_action_do },<br /> <br />     { "mdate", vlclua_mdate },<br />     { "mwait", vlclua_mwait },<br />diff --git a/share/lua/README.txt b/share/lua/README.txt<br />index eb782ee030..2c2fabf0d1 100644<br />--- a/share/lua/README.txt<br />+++ b/share/lua/README.txt<br />@@ -151,6 +151,7 @@ misc.copyright(): Get the VLC copyright statement.<br /> misc.license(): Get the VLC license.<br /> <br /> misc.action_id( name ): get the id of the given action.<br />+misc.action_do( id, notify ): execute the action identified by the id<br /> <br /> misc.mdate(): Get the current date (in microseconds).<br /> misc.mwait(): Wait for the given date (in microseconds).<br />diff --git a/share/lua/modules/common.lua b/share/lua/modules/common.lua<br />index 8c49c713e5..4c13eeae34 100644<br />--- a/share/lua/modules/common.lua<br />+++ b/share/lua/modules/common.lua<br />@@ -25,8 +25,11 @@ end<br /> function hotkey(arg)<br />     local id = vlc.misc.action_id( arg )<br />     if id ~= nil then<br />-        vlc.var.set( vlc.object.libvlc(), "key-action", id )<br />-        return true<br />+        if vlc.misc.action_do( id, true ) == 0 then<br />+            return true<br />+        else<br />+            return false<br />+        end<br />     else<br />         return false<br />     end</pre></blockquote></div><br clear="all">Broken by design API. The script has no way to express the context of the action.<br>
-- <br>
Rémi Denis-Courmont<br>
Typed on an inconvenient virtual keyboard</body></html>