From 2c0af15325939a653c1560fea0ac8a073c86fcd2 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 11 Sep 2012 20:48:27 +0200 Subject: [PATCH 1/4] Torcache doesn't give back proper 404 --- couchpotato/core/downloaders/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/downloaders/base.py b/couchpotato/core/downloaders/base.py index eb70420..504ddac 100644 --- a/couchpotato/core/downloaders/base.py +++ b/couchpotato/core/downloaders/base.py @@ -67,7 +67,10 @@ class Downloader(Plugin): for source in sources: try: - filedata = self.urlopen(source % torrent_hash, show_error = False) + filedata = self.urlopen(source % torrent_hash, headers = {'Referer': ''}, show_error = False) + if 'torcache' in filedata and 'file not found' in filedata.lower(): + continue + return filedata except: log.debug('Torrent hash "%s" wasn\'t found on: %s', (torrent_hash, source)) From d2901bc68a0d82d820396555cd0186aaf446bdf7 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 11 Sep 2012 21:32:36 +0200 Subject: [PATCH 2/4] 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 ab23a18..d3c2ccc 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 9238f45..0fd91bf 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', '')), From 45bb88460c75bfd7f73f40923bbc3877c38ad3bf Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 14 Sep 2012 12:42:52 +0200 Subject: [PATCH 3/4] Remove wrongly added movies. --- couchpotato/core/plugins/searcher/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/couchpotato/core/plugins/searcher/main.py b/couchpotato/core/plugins/searcher/main.py index d088c66..567b84e 100644 --- a/couchpotato/core/plugins/searcher/main.py +++ b/couchpotato/core/plugins/searcher/main.py @@ -93,6 +93,8 @@ class Searcher(Plugin): default_title = getTitle(movie['library']) if not default_title: + log.error('No proper info found for movie, removing it from library to cause it from having more issues.') + fireEvent('movie.delete', movie['id'], single = True) return fireEvent('notify.frontend', type = 'searcher.started.%s' % movie['id'], data = True, message = 'Searching for "%s"' % default_title) From de6d686fe5fae2388e6f3b8286ab0fc07bed9b0c Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 14 Sep 2012 12:44:26 +0200 Subject: [PATCH 4/4] Add API version to CP calls --- couchpotato/core/providers/movie/couchpotatoapi/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/providers/movie/couchpotatoapi/main.py b/couchpotato/core/providers/movie/couchpotatoapi/main.py index 4379bb8..d1c1338 100644 --- a/couchpotato/core/providers/movie/couchpotatoapi/main.py +++ b/couchpotato/core/providers/movie/couchpotatoapi/main.py @@ -29,7 +29,10 @@ class CouchPotatoApi(MovieProvider): if identifier is None: return {} try: - headers = {'X-CP-Version': fireEvent('app.version', single = True)} + headers = { + 'X-CP-Version': fireEvent('app.version', single = True), + 'X-CP-API': 1, + } data = self.urlopen((self.api_url % ('eta')) + (identifier + '/'), headers = headers) dates = json.loads(data) log.debug('Found ETA for %s: %s', (identifier, dates))