# -*- coding: UTF-8 -*- __revision__ = '$Id: PluginMovieIMDB.py 1660 2014-03-13 20:48:05Z mikej06 $' # Copyright (c) 2005-2013 Vasco Nunes, 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 import gutils, movie import string, re plugin_name = 'IMDb' plugin_description = 'Internet Movie Database' plugin_url = 'www.imdb.com' plugin_language = _('English') plugin_author = 'Vasco Nunes, Piotr Ożarowski' plugin_author_email = 'griffith@griffith.cc' plugin_version = '1.19' class Plugin(movie.Movie): def __init__(self, id): self.encode = 'utf-8' self.movie_id = id self.url = "https://www.imdb.com/title/tt%s/" % self.movie_id def initialize(self): self.cast_page = self.open_page(url=self.url + 'fullcredits') self.plot_page = self.open_page(url=self.url + 'plotsummary') self.comp_page = self.open_page(url=self.url + 'companycredits') self.tagl_page = self.open_page(url=self.url + 'taglines') self.cert_page = self.open_page(url=self.url + 'parentalguide') self.release_page = self.open_page(url=self.url + 'releaseinfo') def get_image(self): self.image_url = '' tmp = gutils.trim(gutils.trim(self.page, '"edges":[{"node":{"entity":{"primaryImage":', '}'), '"url":"', '"') if tmp: self.image_url = tmp else: tmp = gutils.trim(self.page, 'ipc-media--poster', '/>') if tmp: self.image_url = gutils.trim(tmp, 'src="', '"') def get_o_title(self): # it seems, that films coming from the German branch can have their German title in the h1-name-tag; # in this case (only?), IMDB renders an additional "originalTitle"-tag. self.o_title = gutils.trim(self.page, '
', '
') + '\n' plotcompilation = plotcompilation + re.sub('<[^<]+?>', '', gutils.trim(listelement, '').replace('\n','').lstrip()) + '\n\n' if plotcompilation <> '': self.plot = plotcompilation else: self.plot = gutils.regextrim(self.page, 'itemprop="description"', '<') self.plot = gutils.after(self.plot, '>') elements = string.split(self.plot_page, '') if len(elements) < 2: elements = re.split('