Browse Source

Blu-ray backlog not working

fixes #3826
pull/3814/merge
Ruud 11 years ago
parent
commit
1d60d9caf1
  1. 37
      couchpotato/core/media/movie/providers/automation/bluray.py

37
couchpotato/core/media/movie/providers/automation/bluray.py

@ -1,3 +1,5 @@
import traceback
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from couchpotato import fireEvent from couchpotato import fireEvent
from couchpotato.core.helpers.rss import RSS from couchpotato.core.helpers.rss import RSS
@ -5,6 +7,7 @@ from couchpotato.core.helpers.variable import tryInt
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.media.movie.providers.automation.base import Automation from couchpotato.core.media.movie.providers.automation.base import Automation
log = CPLog(__name__) log = CPLog(__name__)
autoload = 'Bluray' autoload = 'Bluray'
@ -34,17 +37,34 @@ class Bluray(Automation, RSS):
try: try:
# Stop if the release year is before the minimal year # Stop if the release year is before the minimal year
page_year = soup.body.find_all('center')[3].table.tr.find_all('td', recursive = False)[3].h3.get_text().split(', ')[1] brk = False
if tryInt(page_year) < self.getMinimal('year'): h3s = soup.body.find_all('h3')
for h3 in h3s:
if h3.parent.name != 'a':
try:
page_year = tryInt(h3.get_text()[-4:])
if page_year > 0 and page_year < self.getMinimal('year'):
brk = True
except:
break break
for table in soup.body.find_all('center')[3].table.tr.find_all('td', recursive = False)[3].find_all('table')[1:20]: if brk:
name = table.h3.get_text().lower().split('blu-ray')[0].strip() break
year = table.small.get_text().split('|')[1].strip()
for h3 in h3s:
try:
if h3.parent.name == 'a':
name = h3.get_text().lower().split('blu-ray')[0].strip()
if not name.find('/') == -1: # make sure it is not a double movie release if not name.find('/') == -1: # make sure it is not a double movie release
continue continue
if not h3.parent.parent.small: # ignore non-movie tables
continue
year = h3.parent.parent.small.get_text().split('|')[1].strip()
if tryInt(year) < self.getMinimal('year'): if tryInt(year) < self.getMinimal('year'):
continue continue
@ -54,7 +74,10 @@ class Bluray(Automation, RSS):
if self.isMinimalMovie(imdb): if self.isMinimalMovie(imdb):
movies.append(imdb['imdb']) movies.append(imdb['imdb'])
except: except:
log.debug('Error loading page: %s', page) log.debug('Error parsing movie html: %s', traceback.format_exc())
break
except:
log.debug('Error loading page %s: %s', (page, traceback.format_exc()))
break break
self.conf('backlog', value = False) self.conf('backlog', value = False)
@ -134,7 +157,7 @@ config = [{
{ {
'name': 'backlog', 'name': 'backlog',
'advanced': True, 'advanced': True,
'description': 'Parses the history until the minimum movie year is reached. (Will be disabled once it has completed)', 'description': ('Parses the history until the minimum movie year is reached. (Takes a while)', 'Will be disabled once it has completed'),
'default': False, 'default': False,
'type': 'bool', 'type': 'bool',
}, },

Loading…
Cancel
Save