From d2901bc68a0d82d820396555cd0186aaf446bdf7 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 11 Sep 2012 21:32:36 +0200 Subject: [PATCH] Use thetvdb to check if the movie is a TV Show. --- couchpotato/core/plugins/movie/main.py | 16 +++++++++++++++- couchpotato/core/providers/movie/imdbapi/main.py | 6 +++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/couchpotato/core/plugins/movie/main.py b/couchpotato/core/plugins/movie/main.py index ab23a18c..d3c2ccc2 100644 --- a/couchpotato/core/plugins/movie/main.py +++ b/couchpotato/core/plugins/movie/main.py @@ -281,8 +281,22 @@ class MoviePlugin(Plugin): def add(self, params = {}, force_readd = True, search_after = True): if not params.get('identifier'): - log.error('Can\'t add movie without imdb identifier.') + msg = 'Can\'t add movie without imdb identifier.' + log.error(msg) + fireEvent('notify.frontend', type = 'movie.is_tvshow', message = msg) return False + else: + try: + url = 'http://thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=%s' % params.get('identifier') + tvdb = self.getCache('thetvdb.%s' % params.get('identifier'), url = url) + if 'series' in tvdb.lower(): + msg = 'Can\'t add movie, seems to be a TV show.' + log.error(msg) + fireEvent('notify.frontend', type = 'movie.is_tvshow', message = msg) + return False + except: + pass + library = fireEvent('library.add', single = True, attrs = params, update_after = False) diff --git a/couchpotato/core/providers/movie/imdbapi/main.py b/couchpotato/core/providers/movie/imdbapi/main.py index 9238f45a..0fd91bf0 100644 --- a/couchpotato/core/providers/movie/imdbapi/main.py +++ b/couchpotato/core/providers/movie/imdbapi/main.py @@ -13,8 +13,8 @@ log = CPLog(__name__) class IMDBAPI(MovieProvider): urls = { - 'search': 'http://www.imdbapi.com/?tomatoes=true&%s', - 'info': 'http://www.imdbapi.com/?tomatoes=true&i=%s', + 'search': 'http://www.imdbapi.com/?%s', + 'info': 'http://www.imdbapi.com/?i=%s', } http_time_between_calls = 0 @@ -90,7 +90,7 @@ class IMDBAPI(MovieProvider): }, 'rating': { 'imdb': (tryFloat(movie.get('imdbRating', 0)), tryInt(movie.get('imdbVotes', '').replace(',', ''))), - 'rotten': (tryFloat(movie.get('tomatoRating', 0)), tryInt(movie.get('tomatoReviews', '').replace(',', ''))), + #'rotten': (tryFloat(movie.get('tomatoRating', 0)), tryInt(movie.get('tomatoReviews', '').replace(',', ''))), }, 'imdb': str(movie.get('imdbID', '')), 'runtime': self.runtimeToMinutes(movie.get('Runtime', '')),