Commit 9ce86f77 authored by Pierre Ynard's avatar Pierre Ynard

lua: rename rc interface to cli

Because a CLI is really what it is
parent c9f8412c
......@@ -70,9 +70,11 @@ static const struct
const char *psz_shortcut;
const char *psz_name;
} pp_shortcuts[] = {
{ "luarc", "rc" },
{ "luacli", "cli" },
{ "luarc", "cli" },
#ifndef WIN32
{ "rc", "rc" },
{ "cli", "cli" },
{ "rc", "cli" },
#endif
{ "luahotkeys", "hotkeys" },
/* { "hotkeys", "hotkeys" }, */
......@@ -347,13 +349,15 @@ int Open_LuaIntf( vlc_object_t *p_this )
free( psz_telnet_passwd );
free( psz_telnet_host );
}
else if( !strcmp( psz_name, "rc" ) )
else if( !strcmp( psz_name, "cli" ) )
{
char *psz_rc_host = var_CreateGetNonEmptyString( p_intf, "rc-host" );
if( !psz_rc_host )
psz_rc_host = var_CreateGetNonEmptyString( p_intf, "cli-host" );
if( psz_rc_host )
{
char *psz_esc_host = config_StringEscape( psz_rc_host );
asprintf( &psz_config, "rc={host='%s'}", psz_esc_host );
asprintf( &psz_config, "cli={host='%s'}", psz_esc_host );
free( psz_esc_host );
free( psz_rc_host );
......@@ -379,6 +383,19 @@ int Open_LuaIntf( vlc_object_t *p_this )
lua_getglobal( L, "config" );
if( lua_istable( L, -1 ) )
{
if( !strcmp( psz_name, "cli" ) )
{
lua_getfield( L, -1, "rc" );
if( lua_istable( L, -1 ) )
{
/* msg_Warn( p_intf, "The `rc' lua interface script "
"was renamed `cli', please update "
"your configuration!" ); */
lua_setfield( L, -2, "cli" );
}
else
lua_pop( L, 1 );
}
lua_getfield( L, -1, psz_name );
if( lua_istable( L, -1 ) )
{
......@@ -399,10 +416,13 @@ int Open_LuaIntf( vlc_object_t *p_this )
/* Wrapper for legacy telnet config */
if ( !strcmp( psz_name, "telnet" ) )
{
char *wrapped_file = vlclua_find_file( p_this, "intf", "rc" );
/* msg_Warn( p_intf, "The `telnet' lua interface script was replaced "
"by `cli', please update your configuration!" ); */
char *wrapped_file = vlclua_find_file( p_this, "intf", "cli" );
if( !wrapped_file )
{
msg_Err( p_intf, "Couldn't find lua interface script \"rc\", "
msg_Err( p_intf, "Couldn't find lua interface script \"cli\", "
"needed by telnet wrapper" );
p_intf->psz_header = NULL;
lua_close( p_sys->L );
......
......@@ -85,6 +85,11 @@
#define RCHOST_TEXT N_("TCP command input")
#define RCHOST_LONGTEXT N_("Accept commands over a socket rather than stdin. " \
"You can set the address and port the interface will bind to." )
#define CLIHOST_TEXT N_("CLI input")
#define CLIHOST_LONGTEXT N_( "Accept commands from this source. " \
"The CLI defaults to stdin (\"*console\"), but can also bind to a " \
"plain TCP socket (\"localhost:4212\") or use the telnet protocol " \
"(\"telnet://0.0.0.0:4212\")" )
static int vlc_sd_probe_Open( vlc_object_t * );
......@@ -109,8 +114,9 @@ vlc_module_begin ()
add_string ( "http-host", NULL, HOST_TEXT, HOST_LONGTEXT, true )
add_string ( "http-src", NULL, SRC_TEXT, SRC_LONGTEXT, true )
add_bool ( "http-index", false, INDEX_TEXT, INDEX_LONGTEXT, true )
set_section( N_("Lua RC"), 0 )
set_section( N_("Lua CLI"), 0 )
add_string( "rc-host", NULL, RCHOST_TEXT, RCHOST_LONGTEXT, true )
add_string( "cli-host", NULL, CLIHOST_TEXT, CLIHOST_LONGTEXT, true )
set_section( N_("Lua Telnet"), 0 )
add_string( "telnet-host", "localhost", TELNETHOST_TEXT,
TELNETHOST_LONGTEXT, true )
......@@ -142,8 +148,10 @@ vlc_module_begin ()
add_submodule ()
set_description( N_("Lua Interface Module (shortcuts)") )
add_shortcut( "luacli" )
add_shortcut( "luarc" )
#ifndef WIN32
add_shortcut( "cli" )
add_shortcut( "rc" )
#endif
set_capability( "interface", 25 )
......
--[==========================================================================[
rc.lua: remote control module for VLC
cli.lua: CLI module for VLC
--[==========================================================================[
Copyright (C) 2007-2011 the VideoLAN team
$Id$
......@@ -24,22 +24,22 @@
description=
[============================================================================[
Remote control interface for VLC
Command Line Interface for VLC
This is a modules/control/rc.c look alike (with a bunch of new features).
It also provides a VLM interface copied from the telnet interface.
Use on local term:
vlc -I rc
vlc -I cli
Use on tcp connection:
vlc -I rc --lua-config "rc={host='localhost:4212'}"
vlc -I cli --lua-config "cli={host='localhost:4212'}"
Use on telnet connection:
vlc -I rc --lua-config "rc={host='telnet://localhost:4212'}"
vlc -I cli --lua-config "cli={host='telnet://localhost:4212'}"
Use on multiple hosts (term + plain tcp port + telnet):
vlc -I rc --lua-config "rc={hosts={'*console','localhost:4212','telnet://localhost:5678'}}"
vlc -I cli --lua-config "cli={hosts={'*console','localhost:4212','telnet://localhost:5678'}}"
Note:
-I rc and -I luarc are aliases for -I lua --lua-intf rc
-I cli and -I luacli are aliases for -I lua --lua-intf cli
Configuration options setable throught the --lua-config option are:
* hosts: A list of hosts to listen on.
......@@ -72,7 +72,7 @@ env = { prompt = "> ";
width = 70;
autocompletion = 1;
autoalias = 1;
welcome = _("Remote control interface initialized. Type `help' for help.");
welcome = _("Command Line Interface initialized. Type `help' for help.");
flatplaylist = 0;
}
......@@ -305,7 +305,7 @@ function help(name,client,arg)
local long = (name == "longhelp")
local extra = ""
if arg then extra = "matching `" .. arg .. "' " end
client:append("+----[ Remote control commands "..extra.."]")
client:append("+----[ CLI commands "..extra.."]")
for i, cmd in ipairs(commands_ordered) do
if (cmd == "" or not commands[cmd].adv or long)
and (not arg or string.match(cmd,arg)) then
......
......@@ -21,8 +21,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]==========================================================================]
--vlc.msg.warn("The telnet lua interface script was replaced by rc, please update your configuration!")
if config.hosts == nil and config.host == nil then
config.host = "telnet://localhost:4212"
else
......
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