[vlc-commits] fix appletrailers playlist parser

Ilkka Ollakka git at videolan.org
Sat Apr 27 15:52:56 CEST 2013


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sat Apr 27 16:52:05 2013 +0300| [2d8becef0f546ead3134cb76b62132ac4d165be9] | committer: Ilkka Ollakka

fix appletrailers playlist parser

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

 share/lua/playlist/appletrailers.lua |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/share/lua/playlist/appletrailers.lua b/share/lua/playlist/appletrailers.lua
index 4d0f5e7..d303ef7 100644
--- a/share/lua/playlist/appletrailers.lua
+++ b/share/lua/playlist/appletrailers.lua
@@ -24,6 +24,7 @@
 function probe()
     return vlc.access == "http"
         and string.match( vlc.path, "trailers.apple.com" )
+        and string.match( vlc.path, "web.inc" )
 end
 
 function find( haystack, needle )
@@ -63,8 +64,9 @@ function parse()
         line = vlc.readline()
         if not line then break end
 
-        if string.match( line, "class=\".-first" ) then
-            description = find( line, "h%d.->(.-)</h%d") .. ' '
+        if string.match( line, "h%d>.-</h%d" ) then
+            description = find( line, "h%d>(.+)</h%d")
+            vlc.msg.dbg(description)
         end
         if string.match( line, 'img src=') then
             for img in string.gmatch(line, '<img src="(http://.*%.jpg)" ') do
@@ -73,20 +75,19 @@ function parse()
             for i,value in pairs(playlist) do
                 if value.arturl == '' then
                     playlist[i].arturl = art_url
-                else break end
+                end
             end
         end
         if string.match( line, 'class="hd".-%.mov') then
-            for urlline,resolution in string.gmatch(line, 'class="hd".-href="(.-%.mov)".-(%d+.-p)') do
+            for urlline,resolution in string.gmatch(line, 'class="hd".-href="(.-%.mov)".->(%d+.-p)') do
                 urlline = string.gsub( urlline, "_"..resolution, "_h"..resolution )
                 table.insert( playlist, { path = urlline,
-                                          name = description ..  '(' .. resolution .. ')',
+                                          name = description.." "..resolution,
                                           arturl = art_url,
-                                          options = {":http-user-agent=QuickTime/7.5", ":play-and-pause"} } )
+                                          options = {":http-user-agent=QuickTime/7.5", ":play-and-pause", ":demux=avformat"} } )
             end
         end
     end
 
-    table.sort(playlist, sort)
     return playlist
 end



More information about the vlc-commits mailing list