[vlc-commits] lua/intf/cli: make info command more versatile

Filip Roséen git at videolan.org
Fri Oct 28 15:57:13 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Fri Oct 28 15:53:50 2016 +0200| [24d0d1e46f11281c6feefd0e54d64a00e2375ad3] | committer: Pierre Ynard

lua/intf/cli: make info command more versatile

Prior to this patch, the "info"-command could only be used to query
information related to the currently playing entity. These changes
allow the user to get information about other entities in the
playlist, based on the playlist-id.

fixes #17549

Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

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

 share/lua/intf/cli.lua | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua
index b6aee56..e02530d 100644
--- a/share/lua/intf/cli.lua
+++ b/share/lua/intf/cli.lua
@@ -353,8 +353,12 @@ function help(name,client,arg)
     client:append("+----[ end of help ]")
 end
 
-function input_info(name,client)
-    local item = vlc.input.item()
+function input_info(name,client,id)
+    local item = nil;
+
+    if id then item = (vlc.playlist.get(id) or {})["item"]
+    else       item = vlc.input.item() end
+
     if(item == nil) then return end
     local infos = item:info()
     infos["Meta data"] = item:metas()
@@ -585,7 +589,7 @@ commands_ordered = {
     { "rate"; { func = rate; args = "[playback rate]"; help = "set playback rate to value" } };
     { "frame"; { func = frame; help = "play frame by frame" } };
     { "fullscreen"; { func = skip2(vlc.video.fullscreen); args = "[on|off]"; help = "toggle fullscreen"; aliases = { "f", "F" } } };
-    { "info"; { func = input_info; help = "information about the current stream" } };
+    { "info"; { func = input_info; args= "[X]"; help = "information about the current stream (or specified id)" } };
     { "stats"; { func = stats; help = "show statistical information" } };
     { "get_time"; { func = get_time("time"); help = "seconds elapsed since stream's beginning" } };
     { "is_playing"; { func = is_playing; help = "1 if a stream plays, 0 otherwise" } };



More information about the vlc-commits mailing list