--[[
Gets metas for tv episode using tvrage.
$Id$
Copyright © 2010 the VideoLAN team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
--]]
function descriptor()
return { scope="network" }
end
-- Replace non alphanumeric char by +
function get_query( title )
-- If we have a .EXT remove the extension.
str = string.gsub( title, "(.*)%....$", "%1" )
return string.gsub( str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
end
function fetch_meta()
local metas = vlc.item:metas()
local showName = metas["showName"]
if not showName then
return false
end
local seasonNumber = metas["seasonNumber"];
if not seasonNumber then
return false
end
local episodeNumber = metas["episodeNumber"];
if not episodeNumber then
return false
end
local fd = vlc.stream("http://services.tvrage.com/feeds/search.php?show=" .. get_query(showName))
if not fd then return nil end
local page = fd:read( 65653 )
fd = nil
_, _, showid = string.find( page, "