]> git.sesse.net Git - vlc/blobdiff - modules/misc/lua/vlc.c
skins2: some optimisation for playlist
[vlc] / modules / misc / lua / vlc.c
index c4016dbe97d0a1803fb78737d215fd4a43d0cf43..43f19d41972c7bc01903522836db7214b83969c3 100644 (file)
@@ -108,13 +108,13 @@ vlc_module_begin ()
         set_section( N_("Lua HTTP"), 0 )
             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, NULL, INDEX_TEXT, INDEX_LONGTEXT, true )
+            add_bool   ( "http-index", false, INDEX_TEXT, INDEX_LONGTEXT, true )
         set_section( N_("Lua RC"), 0 )
             add_string( "rc-host", NULL, RCHOST_TEXT, RCHOST_LONGTEXT, true )
         set_section( N_("Lua Telnet"), 0 )
             add_string( "telnet-host", "localhost", TELNETHOST_TEXT,
                         TELNETHOST_LONGTEXT, true )
-            add_integer( "telnet-port", TELNETPORT_DEFAULT, NULL, TELNETPORT_TEXT,
+            add_integer( "telnet-port", TELNETPORT_DEFAULT, TELNETPORT_TEXT,
                          TELNETPORT_LONGTEXT, true )
             add_password( "telnet-password", TELNETPWD_DEFAULT, TELNETPWD_TEXT,
                           TELNETPWD_LONGTEXT, true )
@@ -225,7 +225,7 @@ int vlclua_dir_list( vlc_object_t *p_this, const char *luadirname,
         i++;
     free( datadir );
 
-#if !(defined(__APPLE__) || defined(SYS_BEOS) || defined(WIN32))
+#if !(defined(__APPLE__) || defined(WIN32))
     if( likely(asprintf( &ppsz_dir_list[i], "%s"DIR_SEP"lua"DIR_SEP"%s",
                          config_GetLibDir(), luadirname ) != -1) )
             i++;
@@ -238,7 +238,7 @@ int vlclua_dir_list( vlc_object_t *p_this, const char *luadirname,
                               psz_datapath, luadirname ) != -1) )
             i++;
 
-#if defined(__APPLE__) || defined(SYS_BEOS)
+#if defined(__APPLE__)
         if( likely(asprintf( &ppsz_dir_list[i],
                              "%s"DIR_SEP"share"DIR_SEP"lua"DIR_SEP"%s",
                              psz_datapath, luadirname ) != -1) )
@@ -256,8 +256,7 @@ int vlclua_dir_list( vlc_object_t *p_this, const char *luadirname,
 
 void vlclua_dir_list_free( char **ppsz_dir_list )
 {
-    char **ppsz_dir;
-    for( ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ )
+    for( char **ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ )
         free( *ppsz_dir );
     free( ppsz_dir_list );
 }
@@ -272,20 +271,19 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
                                   void * user_data)
 {
     char **ppsz_dir_list = NULL;
+    int i_ret;
 
-    int i_ret = vlclua_dir_list( p_this, luadirname, &ppsz_dir_list );
-    if( i_ret != VLC_SUCCESS )
+    if((i_ret = vlclua_dir_list( p_this, luadirname, &ppsz_dir_list ) != VLC_SUCCESS))
         return i_ret;
-    i_ret = VLC_EGENERIC;
 
+    i_ret = VLC_EGENERIC;
     for( char **ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ )
     {
         char **ppsz_filelist;
-        int i_files;
 
         msg_Dbg( p_this, "Trying Lua scripts in %s", *ppsz_dir );
-        i_files = vlc_scandir( *ppsz_dir, &ppsz_filelist, file_select,
-                                file_compare );
+        int i_files = vlc_scandir( *ppsz_dir, &ppsz_filelist, file_select,
+                                   file_compare );
         if( i_files < 0 )
             continue;
 
@@ -326,9 +324,9 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
 char *vlclua_find_file( vlc_object_t *p_this, const char *psz_luadirname, const char *psz_name )
 {
     char **ppsz_dir_list = NULL;
-    char **ppsz_dir;
     vlclua_dir_list( p_this, psz_luadirname, &ppsz_dir_list );
-    for( ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ )
+
+    for( char **ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ )
     {
         for( const char **ppsz_ext = ppsz_lua_exts; *ppsz_ext; ppsz_ext++ )
         {
@@ -581,6 +579,7 @@ int __vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
                     /* Append item to playlist */
                     if( p_parent ) /* Add to node */
                     {
+                        input_item_CopyOptions( p_parent, p_input );
                         input_item_node_AppendItem( p_parent_node, p_input );
                     }
                     else /* Play or Enqueue (preparse) */