Commit c52dde2d authored by François Cartegnie's avatar François Cartegnie 🤞

lua sd: add source as meta for faster skipping of unrelated resources

parent 24c3ed9f
......@@ -52,6 +52,10 @@ end
function fetch_art()
local meta = vlc.item:metas()
if meta["Listing Type"] == "radio"
or meta["Listing Type"] == "tv"
then return nil end
if meta["artist"] and meta["album"] then
query = "artist:\"" .. meta["artist"] .. "\" AND release:\"" .. meta["album"] .. "\""
relquery = "http://mb.videolan.org/ws/2/release/?query=" .. vlc.strings.encode_uri_component( query )
......
......@@ -25,10 +25,14 @@ function fetch_art()
local meta = vlc.item:metas()
-- IceCast Entries
if meta["Listing Source"] == "dir.xiph.org"
-- Radio Entries
if meta["Listing Type"] == "radio"
then
title = meta["title"] .. " radio logo"
-- TV Entries
elseif meta["Listing Type"] == "tv"
then
title = meta["title"] .. " tv logo"
-- Album entries
elseif meta["artist"] and meta["album"] then
title = meta["artist"].." "..meta["album"].." cover"
......
......@@ -23,6 +23,11 @@
function fetch_art()
if vlc.item == nil then return nil end
local meta = vlc.item:metas()
if meta["Listing Type"] == "radio"
or meta["Listing Type"] == "tv"
then return nil end
if meta["artist"] and meta["album"] then
title = meta["artist"].."/"..meta["album"]
else
......
......@@ -86,7 +86,13 @@ function main()
_, _, option = string.find( line, ":(.+)" )
table.insert( options, option )
else
vlc.sd.add_item( {path=line,duration=duration,artist=artist,title=name,arturl=arturl,options=options} )
vlc.sd.add_item({ path = line,
duration = duration,
artist = artist,
title = name,
arturl = arturl,
meta = {["Listing Type"]="tv"},
options = options })
duration = nil
artist = nil
name = nil
......
......@@ -47,6 +47,7 @@ function main()
.. station.children_map["listen_url"][1].children[1],
meta={
["Listing Source"]="dir.xiph.org",
["Listing Type"]="radio",
["Icecast Bitrate"]=station.children_map["bitrate"][1].children[1],
["Icecast Server Type"]=station.children_map["server_type"][1].children[1]
}} )
......
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