end
function main()
- fd = vlc.stream( "http://trailers.apple.com/trailers/iphone/home/feeds/just_added.json" )
+ fd = vlc.stream( "http://trailers.apple.com/trailers/home/feeds/just_hd.json" )
if not fd then return nil end
- options = {":http-user-agent='iPhone'"}
- while true
+ line = fd:readline()
+ while line ~= nil
do
- line = fd:readline()
- if not line then break end
- if string.match( line, "title" ) and string.match( line, "hd\":true")then
+ if string.match( line, "title" ) then
title = vlc.strings.resolve_xml_special_chars( find( line, "title\":\"(.-)\""))
art = find( line, "poster\":\"(.-)\"")
- url = find( line, "url\":\"(.-)\"")
- url = string.gsub( url, "trailers/","trailers/iphone/")
- url = "http://trailers.apple.com"..url.."trailer/"
- vlc.sd.add_item( { path = url, name=title, title=title, options=options, arturl=art})
+ if string.match( art, "http://" ) then
+ else
+ art = "http://trailers.apple.com"..art
+ end
+
+ url = find( line, "location\":\"(.-)\"")
+ node = vlc.sd.add_item( {title = title,
+ path = "http://trailers.apple.com"..url.."includes/playlists/web.inc",
+ arturl = art})
+
end
+ line = fd:readline()
end
end