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

Rafaël Carré git at videolan.org
Thu Mar 22 01:42:21 CET 2012


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Wed Mar 21 20:41:40 2012 -0400| [47a9b9905ad74daa283af81e2a21715df2900b4e] | committer: Rafaël Carré

httplua: export art by playlist item id

Usage: http://localhost:8080/art?item=1234

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

 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