From: Ilkka Ollakka Date: Fri, 21 May 2010 11:00:08 +0000 (+0300) Subject: appletrailers sd: rewrite X-Git-Tag: 1.2.0-pre1~6571 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=e78e5ad1873afe798aafc830c2dd6e3f01c6c4f8;p=vlc appletrailers sd: rewrite Don't use the iphone-trick, but instead parse the playlist-file and add all the video-types on one run. Seems that when adding nodes on lua sd plugin, theres some flickering. --- diff --git a/share/lua/sd/appletrailers.lua b/share/lua/sd/appletrailers.lua index 3afd184680..69d9a68230 100644 --- a/share/lua/sd/appletrailers.lua +++ b/share/lua/sd/appletrailers.lua @@ -30,28 +30,47 @@ function find( haystack, needle ) 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 + options = {":http-user-agent=QuickTime/7.2 vlc edition",":demux=avformat",":play-and-pause"} + 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, "location\":\"(.-)\"") - trailertype = "" - trailertype = find( line, "type\":\"(.-)\"") - vlc.msg.err(trailertype) - if trailertype then - trailertype = string.gsub( trailertype, " ", "") - trailertype = string.lower( trailertype ) - else - trailertype = "trailer" + + url = find( line, "url\":\"(.-)\"") + playlist = vlc.stream( "http://trailers.apple.com"..url.."includes/playlists/web.inc" ) + if not playlist then + vlc.msg.info("Didn't get playlist...") + end + + node = vlc.sd.add_node( {title=title,arturl=art} ) + + playlistline = playlist:readline() + description ="" + vlc.msg.info( "http://trailers.apple.com"..url.."includes/playlists/web.inc" ) + if not playlistline then vlc.msg.info("Empty playlists-file") end + while playlistline ~= nil + do + if string.match( playlistline, "class=\".-first" ) then + description = find( playlistline, "h%d.->(.-)