2 Translate www.katsomo.fi video webpages URLs to the corresponding
6 Copyright © 2009 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, "www.katsomo.fi" )
29 function find( haystack, needle )
30 local _,_,r = string.find( haystack, needle )
40 if not line then break end
41 if string.match( line, "<title>" )
43 title = vlc.strings.decode_uri( find( line, "<title>(.-)<" ) )
45 if string.match( line, "<li class=\"program\"" )
47 description = vlc.strings.resolve_xml_special_chars( find( line, "title=\"(.-)\"" ) )
49 for programid in string.gmatch( line, "<li class=\"program\" id=\"program(.-)\"" ) do
50 path = "http://www.katsomo.fi/metafile.asx?p="..programid.."&bw=800"
51 table.insert( p, { path = path; name = title; description = description; url = vlc.path;} )