Merge branch 'refs/heads/develop' into nosql

Conflicts:
	couchpotato/core/media/__init__.py
	couchpotato/core/notifications/trakt/main.py
This commit is contained in:
Ruud committed 2014-02-16 15:56:18 +01:00
commit 6437079be3
25 files changed
+877 -482

No files matched your search

+28 -13
View File
@@ -11,6 +11,7 @@ class Trakt(Notification):
'base': 'http://api.trakt.tv/%s',
'library': 'movie/library/%s',
'unwatchlist': 'movie/unwatchlist/%s',
'test': 'account/test/%s',
}
listen_to = ['movie.downloaded']
@@ -18,25 +19,39 @@ class Trakt(Notification):
def notify(self, message = '', data = None, listener = None):
if not data: data = {}
post_data = {
'username': self.conf('automation_username'),
'password' : self.conf('automation_password'),
'movies': [{
'imdb_id': data['identifier'],
'title': getTitle(data),
'year': data['info']['year']
}] if data else []
}
if listener == 'test':
result = self.call((self.urls['library'] % self.conf('automation_api_key')), post_data)
if self.conf('remove_watchlist_enabled'):
result = result and self.call((self.urls['unwatchlist'] % self.conf('automation_api_key')), post_data)
post_data = {
'username': self.conf('automation_username'),
'password': self.conf('automation_password'),
}
return result
result = self.call((self.urls['test'] % self.conf('automation_api_key')), post_data)
return result
else:
post_data = {
'username': self.conf('automation_username'),
'password': self.conf('automation_password'),
'movies': [{
'imdb_id': data['identifier'],
'title': getTitle(data),
'year': data['info']['year']
}] if data else []
}
result = self.call((self.urls['library'] % self.conf('automation_api_key')), post_data)
if self.conf('remove_watchlist_enabled'):
result = result and self.call((self.urls['unwatchlist'] % self.conf('automation_api_key')), post_data)
return result
def call(self, method_url, post_data):
try:
response = self.getJsonData(self.urls['base'] % method_url, data = post_data, cache_timeout = 1)
if response:
if response.get('status') == "success":