Code: Select all
function get_artist_image_filename()
local url = get_artist_image_url()
if url == nil then return nil end
local stream = vlc.stream(url)
if stream == nil then return nil end
local data = stream:read(1024*1024)
if data == nil then return nil end
local fname = os.tmpname()
if fname == nil then return nil end
--local fhandle = io.tmpfile()
local fhandle = io.open(fname, "wb")
--local fhandle = assert(io.open(fname, "wb"))
if fhandle == nil then return nil end
fhandle:write(data)
fhandle:close()
return fname
end
Return to “Scripting VLC in lua”
Users browsing this forum: No registered users and 8 guests