Commit c52dde2d authored by Francois Cartegnie's avatar Francois Cartegnie

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

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