Commit 4bde22b6 authored by Antoine Cellerier's avatar Antoine Cellerier

Fix problem with the search lua wrapper (it always returned the "category"...

Fix problem with the search lua wrapper (it always returned the "category" playlist even when searching in "onelevel" mode).
Remove debug prints from the rc.lua module.
parent 2d3320dc
......@@ -567,48 +567,16 @@ static int vlclua_playlist_get( lua_State *L )
vlc_object_release( p_playlist );
return 1;
}
#if 0
int s;
lua_createtable( L, 0, 2 + p_playlist->i_sds );
for( s = -2; s < p_playlist->i_sds; s++ )
{
playlist_item_t *p_root;
switch( s )
{
case -2:
/* local/normal playlist */
lua_pushstring( L, "local" );
p_root = p_playlist->p_local_onelevel;
break;
case -1:
/* media library */
lua_pushstring( L, "ml" );
p_root = p_playlist->p_ml_onelevel;
break;
default:
lua_pushstring( L, p_playlist->pp_sds[s]->p_sd->psz_module );
printf("%s\n", p_playlist->pp_sds[s]->p_sd->psz_module );
p_root = p_playlist->pp_sds[s]->p_one;
break;
}
printf("s = %d\n", s);
printf("children = %d\n", p_root->i_children );
push_playlist_item( L, p_root );
lua_settable( L, -3 );
}
printf("done\n");
#endif
static int vlclua_playlist_search( lua_State *L )
{
playlist_t *p_playlist = vlclua_get_playlist_internal( L );
const char *psz_string = luaL_optstring( L, 1, "" );
int b_category = luaL_optboolean( L, 2, 1 ); /* default to category */
playlist_LiveSearchUpdate( p_playlist,
b_category ? p_playlist->p_root_category
: p_playlist->p_root_onelevel,
psz_string );
push_playlist_item( L, p_playlist->p_root_category );
playlist_item_t *p_item = b_category ? p_playlist->p_root_category
: p_playlist->p_root_onelevel;
playlist_LiveSearchUpdate( p_playlist, p_item, psz_string );
push_playlist_item( L, p_item );
vlc_object_release( p_playlist );
return 1;
}
......
......@@ -198,15 +198,12 @@ function playlist(name,client,arg)
end
local playlist
local tree = playlist_is_tree(client)
print("tree",tree)
if name == "search" then
playlist = vlc.playlist.search(arg or "", tree)
else
if tonumber(arg) then
print "number"
playlist = vlc.playlist.get(tonumber(arg), tree)
elseif arg then
print "string"
playlist = vlc.playlist.get(arg, tree)
else
playlist = vlc.playlist.get(nil, tree)
......
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