Commit f99934ec authored by Pierre Ynard's avatar 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: default avatarPierre Ynard <linkfanel@yahoo.fr>
parent f6820a31
...@@ -283,6 +283,12 @@ function services_discovery(name,client,arg) ...@@ -283,6 +283,12 @@ function services_discovery(name,client,arg)
end end
end end
function load_vlm(name, client, value)
if vlm == nil then
vlm = vlc.vlm()
end
end
function print_text(label,text) function print_text(label,text)
return function(name,client) return function(name,client)
client:append("+----[ "..label.." ]") client:append("+----[ "..label.." ]")
...@@ -296,7 +302,7 @@ function print_text(label,text) ...@@ -296,7 +302,7 @@ function print_text(label,text)
end end
function help(name,client,arg) function help(name,client,arg)
if arg == nil then if arg == nil and vlm ~= nil then
client:append("+----[ VLM commands ]") client:append("+----[ VLM commands ]")
local message, vlc_err = vlm:execute_command("help") local message, vlc_err = vlm:execute_command("help")
vlm_message_to_string( client, message, "|" ) vlm_message_to_string( client, message, "|" )
...@@ -576,6 +582,7 @@ commands_ordered = { ...@@ -576,6 +582,7 @@ commands_ordered = {
{ "hotkey"; { func = hotkey; args = "[hotkey name]"; help = "simulate hotkey press"; adv = true; aliases = { "key" } } }; { "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 } }; { "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 } }; { "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 } }; { "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 } }; { "alias"; { func = skip(alias); args = "[cmd]"; help = "set/get command aliases"; adv = true } };
...@@ -654,6 +661,9 @@ function call_command(cmd,client,arg) ...@@ -654,6 +661,9 @@ function call_command(cmd,client,arg)
end end
function call_vlm_command(cmd,client,arg) function call_vlm_command(cmd,client,arg)
if vlm == nil then
return -1
end
if arg ~= nil then if arg ~= nil then
cmd = cmd.." "..arg cmd = cmd.." "..arg
end end
...@@ -783,9 +793,6 @@ h.status_callbacks[host.status.write] = on_write ...@@ -783,9 +793,6 @@ h.status_callbacks[host.status.write] = on_write
h:listen( config.hosts or config.host or "*console" ) h:listen( config.hosts or config.host or "*console" )
password = config.password or "admin" password = config.password or "admin"
--[[ Launch vlm ]]
vlm = vlc.vlm()
--[[ The main loop ]] --[[ The main loop ]]
while not vlc.misc.should_die() do while not vlc.misc.should_die() do
local write, read = h:accept_and_select() local write, read = h:accept_and_select()
......
...@@ -45,5 +45,8 @@ else ...@@ -45,5 +45,8 @@ else
end end
end end
--[[ Launch vlm ]]
vlm = vlc.vlm()
dofile(wrapped_file) dofile(wrapped_file)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment