]> git.sesse.net Git - vlc/blobdiff - share/lua/sd/appletrailers.lua
vasprintf: rewrite. va_copy() was missing.
[vlc] / share / lua / sd / appletrailers.lua
index 92beddab999496c54644df6df01fb687ab18ede9..244f30e5d66e8e98de2f180a65b6ef2aa6763b46 100644 (file)
@@ -32,41 +32,22 @@ end
 function main()
     fd = vlc.stream( "http://trailers.apple.com/trailers/home/feeds/just_hd.json" )
     if not fd then return nil end
-    options = {":http-user-agent=QuickTime/7.2 vlc edition",":demux=avformat,ffmpeg",":play-and-pause"}
     line = fd:readline()
     while line ~= nil
     do
          if string.match( line, "title" ) then 
             title = vlc.strings.resolve_xml_special_chars( find( line, "title\":\"(.-)\""))
             art = find( line, "poster\":\"(.-)\"")
-            art = "http://trailers.apple.com"..art
-
-            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...")
+            if string.match( art, "http://" ) then
+            else
+                art = "http://trailers.apple.com"..art
             end
 
-            node = vlc.sd.add_node( {title=title,arturl=art} )
+            url = find( line, "location\":\"(.-)\"")
+            node = vlc.sd.add_item( {title  = title,
+                                     path   = "http://trailers.apple.com"..url.."includes/playlists/web.inc",
+                                     arturl = art})
 
-            playlistline = playlist:readline()
-            description =""
-            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.->(.-)</h%d")
-                end
-                if string.match( playlistline, "class=\"hd\".-\.mov") then
-                    for urlline,resolution in string.gmatch(playlistline, "class=\"hd\".-href=\"(.-.mov)\".-(%d+.-p)") do
-                        urlline = string.gsub( urlline, "_"..resolution, "_h"..resolution )
-                        node:add_subitem( {path = urlline,
-                                  title=title.." "..description.." ("..resolution..")",
-                                  options=options, arturl=art })
-                    end
-                end
-                playlistline = playlist:readline()
-            end
          end
          line = fd:readline()
     end