[vlc-commits] cli: add a command to load the VLM

Pierre Ynard git at videolan.org
Sun Dec 4 07:57:10 CET 2011


vlc/vlc-1.2 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Dec  4 07:55:22 2011 +0100| [f99934ec1d06cd0447cb2e48e74b4a7a7277759f] | committer: Pierre Ynard

cli: add a command to load the VLM

The VLM isn't loaded on start-up anymore, except when using the telnet
wrapper, for compatibility reasons.

Fixes #5420
(cherry picked from commit de721bf97706dd38b8156d887f7f03760f7c48c1)

Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=f99934ec1d06cd0447cb2e48e74b4a7a7277759f
---

 share/lua/intf/cli.lua    |   15 +++++++++++----
 share/lua/intf/telnet.lua |    3 +++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
index 4432f2d..265b938 100644
--- a/share/lua/intf/cli.lua
+++ b/share/lua/intf/cli.lua
@@ -283,6 +283,12 @@ function services_discovery(name,client,arg)
     end
 end
 
+function load_vlm(name, client, value)
+    if vlm == nil then
+        vlm = vlc.vlm()
+    end
+end
+
 function print_text(label,text)
     return function(name,client)
         client:append("+----[ "..label.." ]")
@@ -296,7 +302,7 @@ function print_text(label,text)
 end
 
 function help(name,client,arg)
-    if arg == nil then
+    if arg == nil and vlm ~= nil then
         client:append("+----[ VLM commands ]")
         local message, vlc_err = vlm:execute_command("help")
         vlm_message_to_string( client, message, "|" )
@@ -576,6 +582,7 @@ commands_ordered = {
     { "hotkey"; { func = hotkey; args = "[hotkey name]"; help = "simulate hotkey press"; adv = true; aliases = { "key" } } };
     { "menu"; { func = menu; args = "[on|off|up|down|left|right|select]"; help = "use menu"; adv = true } };
     { "" };
+    { "vlm"; { func = load_vlm; help = "load the VLM" } };
     { "set"; { func = set_env; args = "[var [value]]"; help = "set/get env var"; adv = true } };
     { "save_env"; { func = save_env; help = "save env vars (for future clients)"; adv = true } };
     { "alias"; { func = skip(alias); args = "[cmd]"; help = "set/get command aliases"; adv = true } };
@@ -654,6 +661,9 @@ function call_command(cmd,client,arg)
 end
 
 function call_vlm_command(cmd,client,arg)
+    if vlm == nil then
+        return -1
+    end
     if arg ~= nil then
         cmd = cmd.." "..arg
     end
@@ -783,9 +793,6 @@ h.status_callbacks[host.status.write] = on_write
 h:listen( config.hosts or config.host or "*console" )
 password = config.password or "admin"
 
---[[ Launch vlm ]]
-vlm = vlc.vlm()
-
 --[[ The main loop ]]
 while not vlc.misc.should_die() do
     local write, read = h:accept_and_select()
diff --git a/share/lua/intf/telnet.lua b/share/lua/intf/telnet.lua
index 4539324..99af1b0 100644
--- a/share/lua/intf/telnet.lua
+++ b/share/lua/intf/telnet.lua
@@ -45,5 +45,8 @@ else
     end
 end
 
+--[[ Launch vlm ]]
+vlm = vlc.vlm()
+
 dofile(wrapped_file)
 



More information about the vlc-commits mailing list