[vlc-commits] commit: appletrailers_iphone: add play-and-stop to optionlist, not sure they work corretly in this form (Ilkka Ollakka )

git at videolan.org git at videolan.org
Thu Apr 22 10:51:18 CEST 2010


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Tue Apr 20 12:28:13 2010 +0300| [ca986886cdcb1d5369ba3401460887ee806dcc80] | committer: Ilkka Ollakka 

appletrailers_iphone: add play-and-stop to optionlist, not sure they work corretly in this form

Also check that hd is true and add different hd-resolutions (with albumart) to playlist.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ca986886cdcb1d5369ba3401460887ee806dcc80
---

 share/lua/playlist/appletrailers_iphone.lua |   19 +++++++++++++++----
 share/lua/sd/appletrailers.lua              |    4 ++--
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/share/lua/playlist/appletrailers_iphone.lua b/share/lua/playlist/appletrailers_iphone.lua
index 5cb27e2..0797a6d 100644
--- a/share/lua/playlist/appletrailers_iphone.lua
+++ b/share/lua/playlist/appletrailers_iphone.lua
@@ -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
diff --git a/share/lua/sd/appletrailers.lua b/share/lua/sd/appletrailers.lua
index b4ae05c..eea68cf 100644
--- a/share/lua/sd/appletrailers.lua
+++ b/share/lua/sd/appletrailers.lua
@@ -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\":\"(.-)\"")



More information about the vlc-commits mailing list