Use test url for trakt notification test. fix #2798
This commit is contained in:
@@ -10,6 +10,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']
|
||||
@@ -17,25 +18,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['library']['identifier'],
|
||||
'title': data['library']['titles'][0]['title'],
|
||||
'year': data['library']['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['library']['identifier'],
|
||||
'title': data['library']['titles'][0]['title'],
|
||||
'year': data['library']['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":
|
||||
|
||||
Reference in New Issue
Block a user