Commit e19d9193 authored by Tomas Krotil's avatar Tomas Krotil Committed by 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 6daa137c
......@@ -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 ...
......
......@@ -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" } };
......
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