Goodfilm fixes. closes #1723

Thanks @qooplmao
This commit is contained in:
Ruud
2013-05-14 00:13:42 +02:00
parent d0c1a119fd
commit de142e8050
2 changed files with 21 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ log = CPLog(__name__)
class Automation(Provider):
enabled_option = 'automation_enabled'
http_time_between_calls = 2
interval = 86400
last_checked = 0

View File

@@ -1,13 +1,13 @@
from bs4 import BeautifulSoup
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.automation.base import Automation
from bs4 import BeautifulSoup
log = CPLog(__name__)
class Goodfilms(Automation):
url = 'http://goodfil.ms/%s/queue'
url = 'http://goodfil.ms/%s/queue?page=%d&without_layout=1'
def getIMDBids(self):
@@ -25,12 +25,25 @@ class Goodfilms(Automation):
def getWatchlist(self):
url = self.url % self.conf('automation_username')
soup = BeautifulSoup(self.getHTMLData(url))
movies = []
page = 1
for movie in soup.find_all('div', attrs = { 'class': 'movie', 'data-film-title': True }):
movies.append({ 'title': movie['data-film-title'], 'year': movie['data-film-year'] })
while True:
url = self.url % (self.conf('automation_username'), page)
data = self.getHTMLData(url)
soup = BeautifulSoup(data)
this_watch_list = soup.find_all('div', attrs = { 'class': 'movie', 'data-film-title': True })
if not this_watch_list: # No Movies
break
for movie in this_watch_list:
movies.append({ 'title': movie['data-film-title'], 'year': movie['data-film-year'] })
if not 'next page' in data.lower():
break
page += 1
return movies