CouchPotato api

This commit is contained in:
Ruud Burger
2011-08-17 17:51:38 +02:00
parent 95be5636ce
commit b69bab4235
2 changed files with 33 additions and 0 deletions
@@ -0,0 +1,6 @@
from .main import CouchPotatoApi
def start():
return CouchPotatoApi()
config = []
@@ -0,0 +1,27 @@
from couchpotato.core.event import addEvent
from couchpotato.core.logger import CPLog
from couchpotato.core.providers.base import MovieProvider
from flask.helpers import json
log = CPLog(__name__)
class CouchPotatoApi(MovieProvider):
apiUrl = 'http://couchpotatoapp.com/api/%s/%s/'
def __init__(self):
addEvent('provider.movie.release_date', self.releaseDate)
def releaseDate(self, imdb_id):
data = self.urlopen(self.apiUrl % ('eta', id))
try:
dates = json.loads(data)
log.info('Found ETA for %s: %s' % (imdb_id, dates))
except Exception, e:
log.error('Error getting ETA for %s: %s' % (imdb_id, e))
return dates