[vlc-commits] httplua: export art by playlist item id

Rafaël Carré git at videolan.org
Sun Apr 1 21:23:54 CEST 2012


vlc/vlc-2.0 | branch: master | Rafaël Carré <funman at videolan.org> | Wed Mar 21 20:41:40 2012 -0400| [331c7c2cf8c36dac9474df8f9d94e62484c79975] | committer: Jean-Baptiste Kempf

httplua: export art by playlist item id

Usage: http://localhost:8080/art?item=1234
(cherry picked from commit 47a9b9905ad74daa283af81e2a21715df2900b4e)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 share/lua/intf/http.lua |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index de37820..9d3e7ed 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -138,9 +138,21 @@ function dirlisting(url,listing,acl_)
 end
 
 -- FIXME: Experimental art support. Needs some cleaning up.
-function callback_art(data, request)
+function callback_art(data, request, args)
     local art = function(data, request)
-        local item = vlc.input.item()
+        local num = nil
+        if args ~= nil then
+            num = string.gmatch(args, "item=(.*)")
+            if num ~= nil then
+                num = num()
+            end
+        end
+        local item
+        if num == nil then
+            item = vlc.input.item()
+        else
+            item = vlc.playlist.get(num).item
+        end
         local metas = item:metas()
         local filename = vlc.strings.decode_uri(string.gsub(metas["artwork_url"],"file://",""))
         local size = vlc.net.stat(filename).size



More information about the vlc-commits mailing list