Browse Source

Merge branch 'rotten_tomatoes_custom_urls' of git://github.com/Lordcrash/CouchPotatoServer into Lordcrash-rotten_tomatoes_custom_urls

pull/1977/merge
Ruud 12 years ago
parent
commit
8ac2869de3
  1. 12
      couchpotato/core/providers/automation/rottentomatoes/__init__.py
  2. 20
      couchpotato/core/providers/automation/rottentomatoes/main.py

12
couchpotato/core/providers/automation/rottentomatoes/__init__.py

@ -11,7 +11,7 @@ config = [{
'list': 'automation_providers', 'list': 'automation_providers',
'name': 'rottentomatoes_automation', 'name': 'rottentomatoes_automation',
'label': 'Rottentomatoes', 'label': 'Rottentomatoes',
'description': 'Imports movies from the rottentomatoes "in theaters"-feed.', 'description': 'Imports movies from rottentomatoes rss feeds specified below.',
'options': [ 'options': [
{ {
'name': 'automation_enabled', 'name': 'automation_enabled',
@ -19,6 +19,16 @@ config = [{
'type': 'enabler', 'type': 'enabler',
}, },
{ {
'name': 'automation_urls_use',
'label': 'Use',
},
{
'name': 'automation_urls',
'label': 'url',
'type': 'combined',
'combine': ['automation_urls_use', 'automation_urls'],
},
{
'name': 'tomatometer_percent', 'name': 'tomatometer_percent',
'default': '80', 'default': '80',
'label': 'Tomatometer', 'label': 'Tomatometer',

20
couchpotato/core/providers/automation/rottentomatoes/main.py

@ -1,5 +1,5 @@
from couchpotato.core.helpers.rss import RSS from couchpotato.core.helpers.rss import RSS
from couchpotato.core.helpers.variable import tryInt from couchpotato.core.helpers.variable import tryInt, splitString
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.providers.automation.base import Automation from couchpotato.core.providers.automation.base import Automation
from xml.etree.ElementTree import QName from xml.etree.ElementTree import QName
@ -11,17 +11,23 @@ log = CPLog(__name__)
class Rottentomatoes(Automation, RSS): class Rottentomatoes(Automation, RSS):
interval = 1800 interval = 1800
urls = {
'namespace': 'http://www.rottentomatoes.com/xmlns/rtmovie/',
'theater': 'http://www.rottentomatoes.com/syndication/rss/in_theaters.xml',
}
def getIMDBids(self): def getIMDBids(self):
movies = [] movies = []
rss_movies = self.getRSSData(self.urls['theater']) rotten_tomatoes_namespace = 'http://www.rottentomatoes.com/xmlns/rtmovie/'
rating_tag = str(QName(self.urls['namespace'], 'tomatometer_percent')) urls = dict(zip(splitString(self.conf('automation_urls')), [tryInt(x) for x in splitString(self.conf('automation_urls_use'))]))
for url in urls:
if not urls[url]:
continue
rss_movies = self.getRSSData(url)
rating_tag = str(QName(rotten_tomatoes_namespace, 'tomatometer_percent'))
for movie in rss_movies: for movie in rss_movies:

Loading…
Cancel
Save