[vlc-devel] [PATCH] added -quiet option for automated interfaces
Ken Self
kenself at optusnet.com.au
Tue Jan 20 00:15:59 CET 2009
---
share/lua/intf/rc.lua | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/share/lua/intf/rc.lua b/share/lua/intf/rc.lua
index 91b1155..0d98a49 100644
--- a/share/lua/intf/rc.lua
+++ b/share/lua/intf/rc.lua
@@ -26,14 +26,14 @@ description=
Remote control interface for VLC
This is a modules/control/rc.c look alike (with a bunch of new features)
-
+
Use on local term:
vlc -I luarc
Use on tcp connection:
vlc -I luarc --lua-config "rc={host='localhost:4212'}"
Use on multiple hosts (term + 2 tcp ports):
vlc -I luarc --lua-config "rc={hosts={'*console','localhost:4212','localhost:5678'}}"
-
+
Note:
-I luarc is an alias for -I lua --lua-intf rc
@@ -51,6 +51,9 @@ description=
* autoalias: If autocompletion returns only one possibility, use it
(0 to disable, 1 to enable).
* flatplaylist: 0 to disable, 1 to enable.
+ * quiet: Suppresses prompt and welcome and also forces a response to all
+ * commands received. This is nicer for automated control and more
+ * like the old rc.c. 0 to disable (default), 1 to enable
]============================================================================]
require("common")
@@ -66,16 +69,17 @@ env = { prompt = "> ";
autoalias = 1;
welcome = "Remote control interface initialized. Type `help' for help.";
flatplaylist = 0;
+ quiet = 0;
}
---[[ Import custom environement variables from the command line config (if possible) ]]
+--[[ Import custom environment variables from the command line config (if possible) ]]
for k,v in pairs(env) do
if config[k] then
if type(env[k]) == type(config[k]) then
env[k] = config[k]
- vlc.msg.dbg("set environement variable `"..k.."' to "..tostring(env[k]))
+ vlc.msg.dbg("set environment variable `"..k.."' to "..tostring(env[k]))
else
- vlc.msg.err("environement variable `"..k.."' should be of type "..type(env[k])..". config value will be discarded.")
+ vlc.msg.err("environment variable `"..k.."' should be of type "..type(env[k])..". config value will be discarded.")
end
end
end
@@ -574,12 +578,12 @@ h = host.host()
-- No auth
h.status_callbacks[host.status.password] = function(client)
client.env = common.table_copy( env )
- client:send( client.env.welcome .. "\r\n")
+ if client.env.quiet ~= 1 then client:send( client.env.welcome .. "\r\n") end
client:switch_status(host.status.read)
end
-- Print prompt when switching a client's status to `read'
h.status_callbacks[host.status.read] = function(client)
- client:send( client.env.prompt )
+ if client.env.quiet ~= 1 then client:send( client.env.prompt ) end
end
h:listen( config.hosts or config.host or "*console" )
@@ -590,6 +594,10 @@ while not vlc.misc.should_die() do
local write, read = h:select(0.1)
for _, client in pairs(write) do
+ if client.env.quiet == 1 and
+ ( ( not client.buffer ) or client.buffer == "" ) then
+ client.buffer = "\r\n"
+ end
local len = client:send()
client.buffer = string.sub(client.buffer,len+1)
if client.buffer == "" then client:switch_status(host.status.read) end
--
1.5.4.3
More information about the vlc-devel
mailing list