Don't show trailer 404 errors

This commit is contained in:
Ruud
2012-10-14 17:32:45 +02:00
parent 3ffc6e122e
commit 4dfd8b4cd5
2 changed files with 17 additions and 3 deletions

View File

@@ -239,7 +239,8 @@ class Plugin(object):
self.setCache(cache_key, data, timeout = cache_timeout)
return data
except:
pass
if not kwargs.get('show_error'):
raise
def setCache(self, cache_key, value, timeout = 300):
log.debug('Setting cache %s', cache_key)

View File

@@ -4,6 +4,7 @@ from couchpotato.core.helpers.variable import mergeDicts, getTitle
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.trailer.base import TrailerProvider
from string import digits, ascii_letters
from urllib2 import HTTPError
import re
log = CPLog(__name__)
@@ -22,7 +23,12 @@ class HDTrailers(TrailerProvider):
movie_name = getTitle(group['library'])
url = self.urls['api'] % self.movieUrlName(movie_name)
data = self.getCache('hdtrailers.%s' % group['library']['identifier'], url)
try:
data = self.getCache('hdtrailers.%s' % group['library']['identifier'], url, show_error = False)
except HTTPError:
log.debug('No page found for: %s', movie_name)
data = None
result_data = {'480p':[], '720p':[], '1080p':[]}
if not data:
@@ -47,7 +53,14 @@ class HDTrailers(TrailerProvider):
movie_name = getTitle(group['library'])
url = "%s?%s" % (self.urls['backup'], tryUrlencode({'s':movie_name}))
data = self.getCache('hdtrailers.alt.%s' % group['library']['identifier'], url)
try:
data = self.getCache('hdtrailers.alt.%s' % group['library']['identifier'], url, show_error = False)
except HTTPError:
log.debug('No alternative page found for: %s', movie_name)
data = None
if not data:
return results
try:
tables = SoupStrainer('div')