# -*- coding: UTF-8 -*- __revision__ = '$Id: PluginMoviePTGate.py 807 2007-07-06 17:02:35Z iznogoud $' # Copyright (c) 2005-2007 Vasco Nunes, Piotr Ozarowski # # 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 import string plugin_name = "PTGate" plugin_description = "Cinema PTGate" plugin_url = "www.cinema.ptgate.pt" plugin_language = _("Portuguese") plugin_author = "Vasco Nunes" plugin_author_email="" plugin_version = "0.4.1" class Plugin(movie.Movie): def __init__(self, id): self.encode='iso-8859-1' self.movie_id = id self.url = "http://cinema.ptgate.pt/filme.php?code=" + str(self.movie_id) def get_image(self): self.image_url = "http://cinema.ptgate.pt/Movies/" + str(self.movie_id)+".jpg" def get_o_title(self): self.o_title = string.capwords(gutils.trim(self.page,"","
") ) def get_title(self): self.title = string.capwords(gutils.trim(self.page,"class=subtitle>","
") ) def get_director(self): self.director = gutils.trim(self.page,"realização
","

") def get_plot(self): self.plot = gutils.trim(self.page,"sinopse
","

") self.plot = string.replace(self.plot,"'","\"") self.plot = string.replace(self.plot,"'","\"") def get_year(self): self.year = gutils.trim(self.page,"
ano
","

pa") def get_runtime(self): self.runtime = "" def get_genre(self): self.genre = gutils.trim(self.page,"nero
","

realiza") self.genre = string.replace(self.genre," | ",", ") def get_cast(self): self.cast = "" self.cast = gutils.trim(self.page,"pretes
","

data de estreia
") self.cast = string.replace(self.cast,"
","\n") self.cast = string.replace(self.cast,"
", "\n") self.cast = gutils.strip_tags(self.cast) def get_classification(self): self.classification = "" def get_studio(self): self.studio = "" def get_o_site(self): self.o_site = gutils.trim(self.page,"tio oficial

") def get_site(self): self.site = gutils.trim(self.page,"
imdb
www.imdb.com") def get_trailer(self): self.trailer = gutils.trim(self.page,"trailer
visionar") def get_country(self): self.country = gutils.trim(self.page,"s
","

g") def get_notes(self): self.notes = gutils.trim(self.page,"prémios e nomeações
", "10): self.rating = int(self.rating/10) self.rating = self.rating*2 else: self.rating="" class SearchPlugin(movie.SearchMovie): def __init__(self): self.original_url_search = "http://cinema.ptgate.pt/pesquisa-filme.php?titulo=" self.translated_url_search = "http://cinema.ptgate.pt/pesquisa-filme.php?titulo=" self.encode='iso-8859-1' def search(self,parent_window): self.open_search(parent_window) self.sub_search() return self.page def sub_search(self): self.page = gutils.trim(self.page,"", "") def get_searches(self): elements = string.split(self.page,"") self.number_results = elements[-1] if (len(elements[0])): for element in elements: element = string.replace(element,"
","") self.ids.append(gutils.trim(element,"?code=","'>")) self.titles.append(gutils.convert_entities(gutils.trim(element,"'>","