Browse Source

Updated the 3 new providers to use imdb_results for is_correct_movie validation and left out the extra_score

since a proper imdb match shouldn't be part of the extra_score.
pull/482/head
bwq 13 years ago
parent
commit
a7bcc9bdfa
  1. 17
      couchpotato/core/providers/torrent/sceneaccess/main.py
  2. 22
      couchpotato/core/providers/torrent/scenehd/main.py
  3. 19
      couchpotato/core/providers/torrent/torrentleech/main.py

17
couchpotato/core/providers/torrent/sceneaccess/main.py

@ -85,11 +85,12 @@ class SceneAccess(TorrentProvider):
else:
new['leechers'] = 0
new['imdbid'] = movie['library']['identifier']
new['extra_score'] = self.extra_score
details = self.urls['detail'] % new['id']
imdb_results = self.imdbMatch(details, movie['library']['identifier'])
new['score'] = fireEvent('score.calculate', new, movie, single = True)
is_correct_movie = fireEvent('searcher.correct_movie', nzb = new, movie = movie, quality = quality,
imdb_results = True, single_category = False, single = True)
imdb_results = imdb_results, single_category = False, single = True)
if is_correct_movie:
new['download'] = self.download
@ -101,10 +102,6 @@ class SceneAccess(TorrentProvider):
log.info("No results found at SceneAccess")
return []
def extra_score(self, nzb):
url = self.urls['detail'] % nzb['id']
imdbId = nzb['imdbid']
return self.imdbMatch(url, imdbId)
def imdbMatch(self, url, imdbId):
try:
@ -112,7 +109,7 @@ class SceneAccess(TorrentProvider):
pass
except IOError:
log.error('Failed to open %s.' % url)
return ''
return False
html = BeautifulSoup(data)
imdbDiv = html.find('span', attrs = {'class':'i_link'})
@ -120,5 +117,5 @@ class SceneAccess(TorrentProvider):
imdbIdAlt = re.sub('tt[0]*', 'tt', imdbId)
if 'imdb.com/title/' + imdbId in imdbDiv or 'imdb.com/title/' + imdbIdAlt in imdbDiv:
return 50
return 0
return True
return False

22
couchpotato/core/providers/torrent/scenehd/main.py

@ -82,17 +82,16 @@ class SceneHD(TorrentProvider):
new['name'] = detailLink['title']
imdbLink = allCells[1].find('a')
imdb_results = False
if imdbLink:
new['imdbresult'] = imdbLink['href'].replace('http://www.imdb.com/title/','').rstrip('/')
else:
new['imdbresult'] = 'tt00000000'
imdbFound = imdbLink['href'].replace('http://www.imdb.com/title/','').rstrip('/')
imdb_results = self.imdbMatch(imdbFound, movie['library']['identifier'])
new['url'] = self.urls['download'] % new['id']
new['imdbid'] = movie['library']['identifier']
new['extra_score'] = self.extra_score
new['score'] = fireEvent('score.calculate', new, movie, single = True)
is_correct_movie = fireEvent('searcher.correct_movie', nzb = new, movie = movie, quality = quality,
imdb_results = True, single_category = False, single = True)
imdb_results = imdb_results, single_category = False, single = True)
if is_correct_movie:
new['download'] = self.download
@ -104,10 +103,9 @@ class SceneHD(TorrentProvider):
log.info("No results found at SceneHD")
return []
def extra_score(self, nzb):
imdbIdAlt = re.sub('tt[0]*', 'tt', nzb['imdbresult'])
if nzb['imdbresult'] == nzb['imdbid'] or imdbIdAlt == nzb['imdbid']:
return 50
return 0
def imdbMatch(self, imdbFound, imdbId):
imdbIdAlt = re.sub('tt[0]*', 'tt', imdbFound)
if imdbFound == imdbId or imdbIdAlt == imdbId:
return True
return False

19
couchpotato/core/providers/torrent/torrentleech/main.py

@ -85,13 +85,14 @@ class TorrentLeech(TorrentProvider):
new['url'] = self.urls['download'] % url['href']
new['size'] = self.parseSize(result.findAll('td')[4].string)
new['seeders'] = int(result.find('td', attrs = {'class' : 'seeders'}).string)
new['leechers'] = int(result.find('td', attrs = {'class' : 'leechers'}).string)
new['imdbid'] = movie['library']['identifier']
new['leechers'] = int(result.find('td', attrs = {'class' : 'leechers'}).string)
details = self.urls['detail'] % new['id']
imdb_results = self.imdbMatch(details, movie['library']['identifier'])
new['extra_score'] = self.extra_score
new['score'] = fireEvent('score.calculate', new, movie, single = True)
is_correct_movie = fireEvent('searcher.correct_movie', nzb = new, movie = movie, quality = quality,
imdb_results = True, single_category = False, single = True)
imdb_results = imdb_results, single_category = False, single = True)
if is_correct_movie:
new['download'] = self.download
@ -103,10 +104,6 @@ class TorrentLeech(TorrentProvider):
log.info("No results found at TorrentLeech")
return []
def extra_score(self, nzb):
url = self.urls['detail'] % nzb['id']
imdbId = nzb['imdbid']
return self.imdbMatch(url, imdbId)
def imdbMatch(self, url, imdbId):
try:
@ -114,10 +111,10 @@ class TorrentLeech(TorrentProvider):
pass
except IOError:
log.error('Failed to open %s.' % url)
return ''
return False
imdbIdAlt = re.sub('tt[0]*', 'tt', imdbId)
data = unicode(data, errors='ignore')
if 'imdb.com/title/' + imdbId in data or 'imdb.com/title/' + imdbIdAlt in data:
return 50
return 0
return True
return False

Loading…
Cancel
Save