Catch renamer.after event errors. fix #1032
This commit is contained in:
@@ -3,6 +3,7 @@ from couchpotato.core.logger import CPLog
|
|||||||
from couchpotato.core.notifications.base import Notification
|
from couchpotato.core.notifications.base import Notification
|
||||||
from flask.helpers import json
|
from flask.helpers import json
|
||||||
import base64
|
import base64
|
||||||
|
import traceback
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
@@ -22,9 +23,12 @@ class XBMC(Notification):
|
|||||||
('VideoLibrary.Scan', {}),
|
('VideoLibrary.Scan', {}),
|
||||||
])
|
])
|
||||||
|
|
||||||
for result in response:
|
try:
|
||||||
if result['result'] == "OK":
|
for result in response:
|
||||||
successful += 1
|
if result['result'] == "OK":
|
||||||
|
successful += 1
|
||||||
|
except:
|
||||||
|
log.error('Failed parsing results: %s', traceback.format_exc())
|
||||||
|
|
||||||
return successful == len(hosts) * 2
|
return successful == len(hosts) * 2
|
||||||
|
|
||||||
@@ -50,10 +54,14 @@ class XBMC(Notification):
|
|||||||
base64string = base64.encodestring('%s:%s' % (self.conf('username'), self.conf('password'))).replace('\n', '')
|
base64string = base64.encodestring('%s:%s' % (self.conf('username'), self.conf('password'))).replace('\n', '')
|
||||||
headers['Authorization'] = 'Basic %s' % base64string
|
headers['Authorization'] = 'Basic %s' % base64string
|
||||||
|
|
||||||
log.debug('Sending request to %s: %s', (host, data))
|
try:
|
||||||
rdata = self.urlopen(server, headers = headers, params = data, multipart = True)
|
log.debug('Sending request to %s: %s', (host, data))
|
||||||
response = json.loads(rdata)
|
rdata = self.urlopen(server, headers = headers, params = data, multipart = True)
|
||||||
log.debug('Returned from request %s: %s', (host, response))
|
response = json.loads(rdata)
|
||||||
|
log.debug('Returned from request %s: %s', (host, response))
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
except:
|
||||||
|
log.error('Failed sending request to XBMC: %s', traceback.format_exc())
|
||||||
|
return []
|
||||||
|
|
||||||
|
|||||||
@@ -383,7 +383,10 @@ class Renamer(Plugin):
|
|||||||
|
|
||||||
# Notify on download, search for trailers etc
|
# Notify on download, search for trailers etc
|
||||||
download_message = 'Downloaded %s (%s)' % (movie_title, replacements['quality'])
|
download_message = 'Downloaded %s (%s)' % (movie_title, replacements['quality'])
|
||||||
fireEvent('renamer.after', message = download_message, group = group, in_order = True)
|
try:
|
||||||
|
fireEvent('renamer.after', message = download_message, group = group, in_order = True)
|
||||||
|
except:
|
||||||
|
log.error('Failed firing (some) of the renamer.after events: %s', traceback.format_exc())
|
||||||
|
|
||||||
# Break if CP wants to shut down
|
# Break if CP wants to shut down
|
||||||
if self.shuttingDown():
|
if self.shuttingDown():
|
||||||
|
|||||||
Reference in New Issue
Block a user