From 5c64ba3c9e6bb9013222373793bb8faacf54c3d2 Mon Sep 17 00:00:00 2001 From: Ruud Date: Tue, 5 Nov 2013 22:45:25 +0100 Subject: [PATCH] Add box office top10 to IMDB automation. closes #2427 --- couchpotato/core/providers/automation/imdb/__init__.py | 9 ++++++++- couchpotato/core/providers/automation/imdb/main.py | 11 +++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/providers/automation/imdb/__init__.py b/couchpotato/core/providers/automation/imdb/__init__.py index 546cba9..20e4f41 100644 --- a/couchpotato/core/providers/automation/imdb/__init__.py +++ b/couchpotato/core/providers/automation/imdb/__init__.py @@ -55,7 +55,14 @@ config = [{ 'label': 'TOP 250', 'description': 'IMDB TOP 250 chart', 'default': True, - }, + }, + { + 'name': 'automation_charts_boxoffice', + 'type': 'bool', + 'label': 'Box offce TOP 10', + 'description': 'IMDB Box office TOP 10 chart', + 'default': True, + }, ], }, ], diff --git a/couchpotato/core/providers/automation/imdb/main.py b/couchpotato/core/providers/automation/imdb/main.py index e9d14b5..76afb24 100644 --- a/couchpotato/core/providers/automation/imdb/main.py +++ b/couchpotato/core/providers/automation/imdb/main.py @@ -70,8 +70,11 @@ class IMDBAutomation(IMDBBase): chart_urls = { 'theater': 'http://www.imdb.com/movies-in-theaters/', 'top250': 'http://www.imdb.com/chart/top', + 'boxoffice': 'http://www.imdb.com/chart/', } + first_table = ['boxoffice'] + def getIMDBids(self): movies = [] @@ -84,6 +87,14 @@ class IMDBAutomation(IMDBBase): try: result_div = html.find('div', attrs = {'id': 'main'}) + + try: + if url in self.first_table: + table = result_div.find('table') + result_div = table if table else result_div + except: + pass + imdb_ids = getImdb(str(result_div), multiple = True) for imdb_id in imdb_ids: