Commit 331c7c2c authored by Rafaël Carré's avatar Rafaël Carré Committed by Jean-Baptiste Kempf

httplua: export art by playlist item id

Usage: http://localhost:8080/art?item=1234
(cherry picked from commit 47a9b990)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 72a9f481
...@@ -138,9 +138,21 @@ function dirlisting(url,listing,acl_) ...@@ -138,9 +138,21 @@ function dirlisting(url,listing,acl_)
end end
-- FIXME: Experimental art support. Needs some cleaning up. -- 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 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 metas = item:metas()
local filename = vlc.strings.decode_uri(string.gsub(metas["artwork_url"],"file://","")) local filename = vlc.strings.decode_uri(string.gsub(metas["artwork_url"],"file://",""))
local size = vlc.net.stat(filename).size local size = vlc.net.stat(filename).size
......
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