]> git.sesse.net Git - vlc/commitdiff
appletrailers sd: fix parsing
authorIlkka Ollakka <ileoo@videolan.org>
Mon, 17 May 2010 10:42:00 +0000 (13:42 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Mon, 17 May 2010 10:42:00 +0000 (13:42 +0300)
Fix parsing to get trailertype. Should help to view all the trailers now.

share/lua/sd/appletrailers.lua

index eea68cf94acd14189f2a2c8434b58e87758348bd..3afd1846801207cc32a5a9455d9eea7ba96233e7 100644 (file)
@@ -40,9 +40,17 @@ function main()
          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\":\"(.-)\"")
-            url = string.gsub( url, "trailers/","trailers/iphone/")
-            url = "http://trailers.apple.com"..url.."trailer/"
+            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"
+            end
+            url = "http://trailers.apple.com"..url..trailertype.."/"
             vlc.sd.add_item( { path = url, name=title, title=title, options=options, arturl=art})
          end
     end