2 Translate trailers.apple.com video webpages URLs to the corresponding
6 Copyright © 2007 the VideoLAN team
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 return vlc.access == "http"
26 and string.match( vlc.path, "trailers.apple.com" )
29 function find( haystack, needle )
30 local _,_,r = string.find( haystack, needle )
37 local description = ''
43 if not line then break end
45 if string.match( line, "class=\".-first" ) then
46 description = find( line, "h%d.->(.-)</h%d")
48 if string.match( line, 'img src=') then
49 for img in string.gmatch(line, '<img src="(http://.*\.jpg)" ') do
52 for i,value in pairs(playlist) do
53 if value.arturl == '' then
54 playlist[i].arturl = art_url
58 if string.match( line, "class=\"hd\".-\.mov") then
59 for urlline,resolution in string.gmatch(line, "class=\"hd\".-href=\"(.-.mov)\".-(%d+.-p)") do
60 urlline = string.gsub( urlline, "_"..resolution, "_h"..resolution )
61 table.insert( playlist, { path = urlline,
62 name = description .. " (" .. resolution .. ")",
64 options = {":http-user-agent=QuickTime/7.2", ":demux=avformat,ffmpeg",":play-and-pause"} } )