]> git.sesse.net Git - vlc/commitdiff
appletrailers_iphone: add play-and-stop to optionlist, not sure they work corretly...
authorIlkka Ollakka <ileoo@videolan.org>
Tue, 20 Apr 2010 09:28:13 +0000 (12:28 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Thu, 22 Apr 2010 08:48:28 +0000 (11:48 +0300)
Also check that hd is true and add different hd-resolutions (with albumart) to playlist.

share/lua/playlist/appletrailers_iphone.lua
share/lua/sd/appletrailers.lua

index 5cb27e26c82a750f63862e55211c08c4e1a56ed9..0797a6d7e3e8e261eacf2e5811751c61ee4c7a0b 100644 (file)
@@ -34,14 +34,20 @@ end
 -- Parse function.
 function parse()
     p = {}
+    path=""
+    arturl=""
+    title=""
+    description=""
     while true
     do 
         line = vlc.readline()
         if not line then break end
-        for path in string.gmatch( line, "http://trailers.apple.com/movies/.-%.mov" ) do
-            path = vlc.strings.decode_uri( path )
-            path = string.gsub( path, "r320i.mov","h480p.mov")
-            table.insert( p, { path=path; name=title; description=description; options={"http-user-agent=Quicktime/7.2.0 vlc lua edition","input-fast-seek";};} )
+        for urli in string.gmatch( line, "http://trailers.apple.com/movies/.-%.mov" ) do
+            path = vlc.strings.decode_uri( urli )
+            vlc.msg.err(path)
+        end
+        for urli in string.gmatch( line, "http://.-%/poster.jpg") do
+            arturl = vlc.strings.decode_uri( urli )
         end
         if string.match( line, "<title>" )
         then
@@ -52,5 +58,10 @@ function parse()
             description = vlc.strings.resolve_xml_special_chars( find( line, "name=\"Description\" content=\"(.-)\"" ) )
         end
     end
+    for index,resolution in ipairs({"480p","720p","1080p"}) do
+        path = string.gsub( path, "r320i.mov","h"..resolution..".mov")
+        vlc.msg.err(arturl)
+        table.insert( p, { path=path; name=title.." ("..resolution..")"; arturl=arturl; description=description; options={":http-user-agent=Quicktime/7.2.0 vlc lua edition",":input-fast-seek",":play-and-stop"};} )
+    end
     return p
 end
index b4ae05c04bd76833fd747a2e2f1fe5e1132545e0..eea68cf94acd14189f2a2c8434b58e87758348bd 100644 (file)
@@ -32,12 +32,12 @@ end
 function main()
     fd = vlc.stream( "http://trailers.apple.com/trailers/iphone/home/feeds/just_added.json" )
     if not fd then return nil end
-    options = {"http-user-agent='iPhone'"}
+    options = {":http-user-agent='iPhone'"}
     while true
     do
          line = fd:readline()
          if not line then break end
-         if string.match( line, "title" ) then
+         if string.match( line, "title" ) and string.match( line, "hd\":true")then
             title = vlc.strings.resolve_xml_special_chars( find( line, "title\":\"(.-)\""))
             art = find( line, "poster\":\"(.-)\"")
             url = find( line, "url\":\"(.-)\"")