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

Filip Roséen filip at atch.se
Thu Oct 27 00:39:51 CEST 2016


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

--

This fix is directly related to the below linked discussion:

  - https://mailman.videolan.org/pipermail/vlc-devel/2016-October/109997.html

---
 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" } };
-- 
2.10.0



More information about the vlc-devel mailing list