[vlc-commits] Added commands move and delete in command line interfaces

Tomas Krotil git at videolan.org
Thu May 2 15:59:05 CEST 2013


vlc | branch: master | Tomas Krotil <krotitom at fel.cvut.cz> | Tue Apr 30 22:53:34 2013 +0200| [e19d91937d373dce643922ee3dda63eed60fd254] | committer: Jean-Baptiste Kempf

Added commands move and delete in command line interfaces

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 at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e19d91937d373dce643922ee3dda63eed60fd254
---

 share/lua/README.txt   |    3 +++
 share/lua/intf/cli.lua |   16 ++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/share/lua/README.txt b/share/lua/README.txt
index 7ac5272..1846938 100644
--- a/share/lua/README.txt
+++ b/share/lua/README.txt
@@ -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 ...
 
diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
index 72c971f..27e7efa 100644
--- a/share/lua/intf/cli.lua
+++ b/share/lua/intf/cli.lua
@@ -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" } };



More information about the vlc-commits mailing list