]> git.sesse.net Git - vlc/blobdiff - modules/misc/lua/vlc.c
lua_intf: also provide the --rc-host option for backward compatibility.
[vlc] / modules / misc / lua / vlc.c
index f7fb5bddf8e7adac41641a3754713a92df312840..ea52557df9eabfaab24ef1ef41497b739f142b84 100644 (file)
 
 #define CONFIG_TEXT N_("Lua interface configuration")
 #define CONFIG_LONGTEXT N_("Lua interface configuration string. Format is: '[\"<interface module name>\"] = { <option> = <value>, ...}, ...'.")
+#define HOST_TEXT N_( "Host address" )
+#define HOST_LONGTEXT N_( \
+    "Address and port the HTTP interface will listen on. It defaults to " \
+    "all network interfaces (0.0.0.0)." \
+    " If you want the HTTP interface to be available only on the local " \
+    "machine, enter 127.0.0.1" )
+#define SRC_TEXT N_( "Source directory" )
+#define SRC_LONGTEXT N_( "Source directory" )
+#define INDEX_TEXT N_( "Directory index" )
+#define INDEX_LONGTEXT N_( "Allow to build directory index" )
+
+#define TELNETHOST_TEXT N_( "Host" )
+#define TELNETHOST_LONGTEXT N_( "This is the host on which the " \
+    "interface will listen. It defaults to all network interfaces (0.0.0.0)." \
+    " If you want this interface to be available only on the local " \
+    "machine, enter \"127.0.0.1\"." )
+#define TELNETPORT_TEXT N_( "Port" )
+#define TELNETPORT_LONGTEXT N_( "This is the TCP port on which this " \
+    "interface will listen. It defaults to 4212." )
+#define TELNETPORT_DEFAULT 4212
+#define TELNETPWD_TEXT N_( "Password" )
+#define TELNETPWD_LONGTEXT N_( "A single administration password is used " \
+    "to protect this interface. The default value is \"admin\"." )
+#define TELNETPWD_DEFAULT "admin"
+#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." )
 
 static int vlc_sd_probe_Open( vlc_object_t * );
 
@@ -66,7 +93,7 @@ vlc_module_begin ()
         set_description( N_("Interfaces implemented using lua scripts") )
         add_shortcut( "luaintf" )
         add_shortcut( "luahttp" )
-        add_shortcut( "http" )
+        /* add_shortcut( "http" ) */
         add_shortcut( "luatelnet" )
         add_shortcut( "telnet" )
         add_shortcut( "luahotkeys" )
@@ -78,6 +105,20 @@ vlc_module_begin ()
                     INTF_TEXT, INTF_LONGTEXT, false )
         add_string( "lua-config", "", NULL,
                     CONFIG_TEXT, CONFIG_LONGTEXT, false )
+        set_section( N_("Lua HTTP"), 0 )
+            add_string ( "http-host", NULL, NULL, HOST_TEXT, HOST_LONGTEXT, true )
+            add_string ( "http-src",  NULL, NULL, SRC_TEXT,  SRC_LONGTEXT,  true )
+            add_bool   ( "http-index", false, NULL, INDEX_TEXT, INDEX_LONGTEXT, true )
+        set_section( N_("Lua RC"), 0 )
+            add_string( "rc-host", NULL, NULL, RCHOST_TEXT, RCHOST_LONGTEXT, true )
+        set_section( N_("Lua Telnet"), 0 )
+            add_string( "telnet-host", "localhost", NULL, TELNETHOST_TEXT,
+                        TELNETHOST_LONGTEXT, true )
+            add_integer( "telnet-port", TELNETPORT_DEFAULT, NULL, TELNETPORT_TEXT,
+                         TELNETPORT_LONGTEXT, true )
+            add_password( "telnet-password", TELNETPWD_DEFAULT, NULL, TELNETPWD_TEXT,
+                          TELNETPWD_LONGTEXT, true )
+
         set_callbacks( Open_LuaIntf, Close_LuaIntf )
 
     add_submodule ()
@@ -651,6 +692,7 @@ static int vlc_sd_probe_Open( vlc_object_t *obj )
             lua_getglobal( L, "descriptor" );
             if( !lua_isfunction( L, lua_gettop( L ) ) || lua_pcall( L, 0, 1, 0 ) )
             {
+                msg_Warn( probe, "No 'descriptor' function in '%s'", psz_filename );
                 lua_pop( L, 1 );
                 if( !( psz_longname = strdup( *ppsz_file ) ) )
                 {