[vlc-devel] [PATCH 2/9] playlist: remove lua search

Romain Vimont rom1v at videolabs.io
Mon Mar 4 11:53:22 CET 2019


The lua API exposed a function to search in (actually, filter) the
playlist. The filtering was directly applied on the core playlist,
so every playlist clients shared the same filter.

The new playlist does not filter. Instead, each client could create its
own filtered view of the core playlist.

We do not want to invest time to implement this for the lua API for now,
so remove the search feature of the "cli" interface.
---
 modules/lua/libs/playlist.c | 12 ------------
 share/lua/intf/cli.lua      | 27 +++++++--------------------
 2 files changed, 7 insertions(+), 32 deletions(-)

diff --git a/modules/lua/libs/playlist.c b/modules/lua/libs/playlist.c
index a3f0ee66f8..cbbcde5eac 100644
--- a/modules/lua/libs/playlist.c
+++ b/modules/lua/libs/playlist.c
@@ -313,17 +313,6 @@ static int vlclua_playlist_get( lua_State *L )
     return 1;
 }
 
-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, "" );
-    PL_LOCK;
-    playlist_LiveSearchUpdate( p_playlist, &p_playlist->root, psz_string, true );
-    push_playlist_item( L, &p_playlist->root );
-    PL_UNLOCK;
-    return 1;
-}
-
 static int vlclua_playlist_current( lua_State *L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
@@ -426,7 +415,6 @@ static const luaL_Reg vlclua_playlist_reg[] = {
     { "add", vlclua_playlist_add },
     { "enqueue", vlclua_playlist_enqueue },
     { "get", vlclua_playlist_get },
-    { "search", vlclua_playlist_search },
     { "current", vlclua_playlist_current },
     { "sort", vlclua_playlist_sort },
     { "status", vlclua_playlist_status },
diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
index 43eaa77b03..3d85e2601a 100644
--- a/share/lua/intf/cli.lua
+++ b/share/lua/intf/cli.lua
@@ -239,22 +239,14 @@ function playlist(name,client,arg)
     end
     local playlist
     local tree = playlist_is_tree(client)
-    if name == "search" then
-        playlist = vlc.playlist.search(arg or "", tree)
+    if tonumber(arg) then
+        playlist = vlc.playlist.get(tonumber(arg), tree)
+    elseif arg then
+        playlist = vlc.playlist.get(arg, tree)
     else
-        if tonumber(arg) then
-            playlist = vlc.playlist.get(tonumber(arg), tree)
-        elseif arg then
-            playlist = vlc.playlist.get(arg, tree)
-        else
-            playlist = vlc.playlist.get(nil, tree)
-        end
-    end
-    if name == "search" then
-        client:append("+----[ Search - "..(arg or "`reset'").." ]")
-    else
-        client:append("+----[ Playlist - "..name.." ]")
+        playlist = vlc.playlist.get(nil, tree)
     end
+    client:append("+----[ Playlist - "..name.." ]")
     if playlist.children then
         for _, item in ipairs(playlist.children) do
             playlist0(item)
@@ -262,11 +254,7 @@ function playlist(name,client,arg)
     else
         playlist0(playlist)
     end
-    if name == "search" then
-        client:append("+----[ End of search - Use `search' to reset ]")
-    else
-        client:append("+----[ End of playlist ]")
-    end
+    client:append("+----[ End of playlist ]")
 end
 
 function playlist_sort(name,client,arg)
@@ -558,7 +546,6 @@ commands_ordered = {
     { "add"; { func = add; args = "XYZ"; help = "add XYZ to playlist" } };
     { "enqueue"; { func = add; args = "XYZ"; help = "queue XYZ to playlist" } };
     { "playlist"; { func = playlist; help = "show items currently in playlist" } };
-    { "search"; { func = playlist; args = "[string]"; help = "search for items in playlist (or reset search)" } };
     { "delete"; { func = skip2(vlc.playlist.delete); args = "[X]"; help = "delete item X in playlist" } };
     { "move"; { func = move; args = "[X][Y]"; help = "move item X in playlist after Y" } };
     { "sort"; { func = playlist_sort; args = "key"; help = "sort the playlist" } };
-- 
2.20.1



More information about the vlc-devel mailing list