]> git.sesse.net Git - vlc/commitdiff
Added commands move and delete in command line interfaces
authorTomas Krotil <krotitom@fel.cvut.cz>
Tue, 30 Apr 2013 20:53:34 +0000 (22:53 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 2 May 2013 13:58:40 +0000 (15:58 +0200)
as ticket #7699, added functionality for telnet and other terminal interfaces for deleting and moving items in playlist.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
share/lua/README.txt
share/lua/intf/cli.lua

index 7ac5272880c6261482b23c43f86aa0085ed82bd4..18469386ee052e85a2e999c004b5a95eb6034c97 100644 (file)
@@ -297,6 +297,9 @@ playlist.sort( key ): sort the playlist according to the key.
                                             'artist', 'genre', 'random', 'duration',
                                             'title numeric' or 'album'.
 playlist.status(): return the playlist status: 'stopped', 'playing', 'paused' or 'unknown'.
+playlist.delete( id ): check if item of id is in playlist and delete it. returns -1 when invalid id.
+playlist.move( id_item, id_where ): take id_item and if id_where has children, it put it as first children, 
+   if id_where don't have children, id_item is put after id_where in same playlist. returns -1 when invalid ids.
 
 FIXME: add methods to get an item's meta, options, es ...
 
index 72c971f8bffcf2eafb268bbc5daf45ccedaf72f2..27e7efa3c798ffae9c6e491c1533b95edb51dcf8 100644 (file)
@@ -186,6 +186,20 @@ function add(name,client,arg)
     f({{path=uri,options=options}})
 end
 
+function move(name,client,arg)
+    local x,y
+    local tbl = {}
+    for token in string.gmatch(arg, "[^%s]+") do
+        table.insert(tbl,token)
+    end
+    x = tonumber(tbl[1])
+    y = tonumber(tbl[2])
+    local res = vlc.playlist.move(x,y)
+    if res == (-1) then
+        client:append("You should choose valid id.")
+    end
+end
+
 function playlist_is_tree( client )
     if client.env.flatplaylist == 0 then
         return true
@@ -524,6 +538,8 @@ commands_ordered = {
     { "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" } };
     { "sd"; { func = services_discovery; args = "[sd]"; help = "show services discovery or toggle" } };
     { "play"; { func = skip2(vlc.playlist.play); help = "play stream" } };