Commit 47a9b990 authored by Rafaël Carré's avatar Rafaël Carré

httplua: export art by playlist item id

Usage: http://localhost:8080/art?item=1234
parent f79f3ae2
...@@ -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