# -*- coding: utf-8 -*- __revision__ = '$Id: PluginMovieWP.py 779 2007-06-20 22:11:45Z piotrek $' # Copyright (c) 2005-2007 Piotr Ożarowski # # 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 Library 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 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # You may use and distribute this software under the terms of the # GNU General Public License, version 2 or later from gettext import gettext as _ import gutils import movie,string import re plugin_name = 'Wirtualna Polska' plugin_description = 'Serwis filmowy Wirtualnej Polski' plugin_url = 'www.film.wp.pl' plugin_language = _('Polish') plugin_author = 'Piotr Ożarowski' plugin_author_email = '' plugin_version = '2.3' class Plugin(movie.Movie): def __init__(self, id): self.movie_id = id self.url = "http://film.wp.pl/id,%s,film_szczegoly.html" % self.movie_id self.encode='iso-8859-2' def initialize(self): self.page = gutils.trim(self.page, '

', '\n') self.cast_page = self.open_page(url="http://film.wp.pl/id,%s,film_obsada_i_tworcy.html" % self.movie_id) self.cast_page = gutils.trim(self.cast_page, '

', "\r\n\r\n") def get_image(self): self.image_url = gutils.trim(self.page, '', 'Tytu\xB3 polski:', "\t\t') pos = string.find(self.title, '(') if pos > -1: self.title = self.title[:pos] def get_director(self): self.director = gutils.trim(self.cast_page, '>re\xBFyser\t', '') def get_plot(self): self.plot = gutils.trim(self.page, ' />', '\t\t
') pos = string.find(self.plot, "
Zobacz tak\xBFe:
") if pos > 0: self.plot = self.plot[:pos] self.plot = string.replace(self.plot,"\r\n\r\n", '') def get_year(self): self.year = gutils.trim(self.page, 'Rok produkcji:', "\t\t
0: self.year = year[0] def get_runtime(self): self.runtime = gutils.trim(self.page, 'Czas trwania:', 'min') runtime = re.findall(r'\d+', self.runtime) if len(runtime)>0: self.runtime = runtime def get_genre(self): self.genre = gutils.trim(self.page, 'Gatunek:', "\t\t ', '') self.genre = string.replace(self.genre, '
', ' / ') def get_cast(self): self.cast = gutils.trim(self.cast_page, '

OBSADA:

', '
') self.cast = string.replace(self.cast, '\t', '') self.cast = string.replace(self.cast, '\n\n<', _(' as ')+'<') self.cast = gutils.strip_tags(self.cast) self.cast = string.replace(self.cast, "%s\n" % _(' as '), "\n") def get_classification(self): self.classification = gutils.trim(self.page, 'Przedzia\xB3 wiekowy:', "\t\tWytw\xF3rnia:', "\t\tKraj produkcji:') if pos == -1: pos = self.page.find('Kraje produkcji:') if pos > -1: self.country = gutils.trim(self.page[pos:], '', "\t\t
') self.number_results = elements[-1] if elements[0] != '': for element in elements: tmp_id = gutils.trim(element,'