From 0e34c8c4b32afeb1ea85ad96f5f80e12d7e9251b Mon Sep 17 00:00:00 2001 From: Nils Vogels Date: Thu, 29 May 2014 02:30:38 +0200 Subject: [PATCH] Backport from https://github.com/thezoggy/Sick-Beard, applied to our branch General cleanups in notifiers. * Cleaned up notifier ui page wording so they follow similar pattern. * Better exception handling for pyTivo and NMJ * Cleaned up logging entries, trying to standardize on what level we report and verbiage (not using contractions, prune out duplicate/excessive entries) --- .../default/config_notifications.tmpl | 23 +++++++------- sickbeard/notifiers/__init__.py | 4 +-- sickbeard/notifiers/boxcar.py | 13 ++++---- sickbeard/notifiers/growl.py | 13 ++++---- sickbeard/notifiers/libnotify.py | 6 ++-- sickbeard/notifiers/nma.py | 10 +++---- sickbeard/notifiers/nmj.py | 30 ++++++++++++++----- sickbeard/notifiers/nmjv2.py | 12 ++++---- sickbeard/notifiers/plex.py | 2 +- sickbeard/notifiers/prowl.py | 8 ++--- sickbeard/notifiers/pushover.py | 14 ++++----- sickbeard/notifiers/pytivo.py | 14 +++++---- sickbeard/notifiers/synoindex.py | 8 ++--- sickbeard/notifiers/tweet.py | 24 +++++++-------- sickbeard/notifiers/xbmc.py | 4 +-- 15 files changed, 97 insertions(+), 88 deletions(-) diff --git a/gui/slick/interfaces/default/config_notifications.tmpl b/gui/slick/interfaces/default/config_notifications.tmpl index 3e99a027..a67adfbb 100644 --- a/gui/slick/interfaces/default/config_notifications.tmpl +++ b/gui/slick/interfaces/default/config_notifications.tmpl @@ -19,9 +19,9 @@
@@ -381,7 +381,8 @@
-

Synology Indexer

+

Synology

+

The Synology DiskStation NAS.

Synology Indexer is the daemon running on the Synology NAS to build its media database.

@@ -390,7 +391,7 @@
diff --git a/sickbeard/notifiers/__init__.py b/sickbeard/notifiers/__init__.py index d73c579d..99ece634 100644 --- a/sickbeard/notifiers/__init__.py +++ b/sickbeard/notifiers/__init__.py @@ -42,7 +42,7 @@ import emailnotify from sickbeard.common import * -# home theater +# home theater / nas xbmc_notifier = xbmc.XBMCNotifier() plex_notifier = plex.PLEXNotifier() nmj_notifier = nmj.NMJNotifier() @@ -60,7 +60,7 @@ boxcar2_notifier = boxcar2.Boxcar2Notifier() nma_notifier = nma.NMA_Notifier() pushalot_notifier = pushalot.PushalotNotifier() pushbullet_notifier = pushbullet.PushbulletNotifier() -# online +# social twitter_notifier = tweet.TwitterNotifier() trakt_notifier = trakt.TraktNotifier() email_notifier = emailnotify.EmailNotifier() diff --git a/sickbeard/notifiers/boxcar.py b/sickbeard/notifiers/boxcar.py index 26feda26..3787e344 100644 --- a/sickbeard/notifiers/boxcar.py +++ b/sickbeard/notifiers/boxcar.py @@ -30,8 +30,8 @@ API_URL = "https://boxcar.io/devices/providers/fWc4sgSmpcN6JujtBmR6/notification class BoxcarNotifier: - def test_notify(self, email, title="Test"): - return self._sendBoxcar("This is a test notification from SickRage", title, email) + def test_notify(self, boxcar_username): + return self._notify("This is a test notification from Sick Beard", "Test", boxcar_username, force=True) def _sendBoxcar(self, msg, title, email, subscribe=False): """ @@ -73,7 +73,7 @@ class BoxcarNotifier: except urllib2.HTTPError, e: # if we get an error back that doesn't have an error code then who knows what's really happening if not hasattr(e, 'code'): - logger.log("Boxcar notification failed." + ex(e), logger.ERROR) + logger.log("Boxcar notification failed. Error code: " + ex(e), logger.ERROR) return False else: logger.log("Boxcar notification failed. Error code: " + str(e.code), logger.WARNING) @@ -104,10 +104,10 @@ class BoxcarNotifier: # If you receive an HTTP status code of 400, it is because you failed to send the proper parameters elif e.code == 400: - logger.log("Wrong data send to boxcar", logger.ERROR) + logger.log("Wrong data sent to boxcar", logger.ERROR) return False - logger.log("Boxcar notification successful.", logger.DEBUG) + logger.log("Boxcar notification successful.", logger.MESSAGE) return True def notify_snatch(self, ep_name, title=notifyStrings[NOTIFY_SNATCH]): @@ -143,8 +143,7 @@ class BoxcarNotifier: logger.log("Sending notification for " + message, logger.DEBUG) - self._sendBoxcar(message, title, username) - return True + return self._sendBoxcar(message, title, username) notifier = BoxcarNotifier diff --git a/sickbeard/notifiers/growl.py b/sickbeard/notifiers/growl.py index aeda68f6..a40141a0 100644 --- a/sickbeard/notifiers/growl.py +++ b/sickbeard/notifiers/growl.py @@ -127,7 +127,7 @@ class GrowlNotifier: for pc in growlHosts: opts['host'] = pc[0] opts['port'] = pc[1] - logger.log(u"Sending growl to " + opts['host'] + ":" + str(opts['port']) + ": " + message) + logger.log(u"GROWL: Sending message '" + message + "' to " + opts['host'] + ":" + str(opts['port']), logger.DEBUG) try: if self._send_growl(opts, message): return True @@ -136,8 +136,8 @@ class GrowlNotifier: return self._send_growl(opts, message) else: return False - except socket.error, e: - logger.log(u"Unable to send growl to " + opts['host'] + ":" + str(opts['port']) + ": " + ex(e)) + except Exception, e: + logger.log(u"GROWL: Unable to send growl to " + opts['host'] + ":" + str(opts['port']) + " - " + ex(e), logger.WARNING) return False def _sendRegistration(self, host=None, password=None, name='SickRage Notification'): @@ -179,10 +179,9 @@ class GrowlNotifier: try: return self._send(opts['host'], opts['port'], register.encode(), opts['debug']) - except socket.error, e: - logger.log( - u"Unable to send growl to " + opts['host'] + ":" + str(opts['port']) + ": " + str(e).decode('utf-8')) + except Exception, e: + logger.log(u"GROWL: Unable to send growl to " + opts['host'] + ":" + str(opts['port']) + " - " + ex(e), logger.WARNING) return False -notifier = GrowlNotifier \ No newline at end of file +notifier = GrowlNotifier diff --git a/sickbeard/notifiers/libnotify.py b/sickbeard/notifiers/libnotify.py index 94273320..2b39db72 100644 --- a/sickbeard/notifiers/libnotify.py +++ b/sickbeard/notifiers/libnotify.py @@ -67,15 +67,15 @@ class LibnotifyNotifier: try: import pynotify except ImportError: - logger.log(u"Unable to import pynotify. libnotify notifications won't work.") + logger.log(u"Unable to import pynotify. libnotify notifications won't work.", logger.ERROR) return False try: import gobject except ImportError: - logger.log(u"Unable to import gobject. We can't catch a GError in display.") + logger.log(u"Unable to import gobject. We can't catch a GError in display.", logger.ERROR) return False if not pynotify.init('SickRage'): - logger.log(u"Initialization of pynotify failed. libnotify notifications won't work.") + logger.log(u"Initialization of pynotify failed. libnotify notifications won't work.", logger.ERROR) return False self.pynotify = pynotify self.gobject = gobject diff --git a/sickbeard/notifiers/nma.py b/sickbeard/notifiers/nma.py index 0ce06a6d..1593e468 100644 --- a/sickbeard/notifiers/nma.py +++ b/sickbeard/notifiers/nma.py @@ -26,7 +26,7 @@ class NMA_Notifier: def _sendNMA(self, nma_api=None, nma_priority=None, event=None, message=None, force=False): - title = 'Sick-Beard' + title = 'SickRage' if not sickbeard.USE_NMA and not force: return False @@ -37,10 +37,6 @@ class NMA_Notifier: if nma_priority == None: nma_priority = sickbeard.NMA_PRIORITY - logger.log(u"NMA title: " + title, logger.DEBUG) - logger.log(u"NMA event: " + event, logger.DEBUG) - logger.log(u"NMA message: " + message, logger.DEBUG) - batch = False p = pynma.PyNMA() @@ -49,13 +45,15 @@ class NMA_Notifier: if len(keys) > 1: batch = True + logger.log("NMA: Sending notice with details: event=\"%s\", message=\"%s\", priority=%s, batch=%s" % (event, message, nma_priority, batch), logger.DEBUG) response = p.push(title, event, message, priority=nma_priority, batch_mode=batch) if not response[nma_api][u'code'] == u'200': logger.log(u'Could not send notification to NotifyMyAndroid', logger.ERROR) return False else: + logger.log(u"NMA: Notification sent to NotifyMyAndroid", logger.MESSAGE) return True -notifier = NMA_Notifier \ No newline at end of file +notifier = NMA_Notifier diff --git a/sickbeard/notifiers/nmj.py b/sickbeard/notifiers/nmj.py index 459942c4..75746ef5 100644 --- a/sickbeard/notifiers/nmj.py +++ b/sickbeard/notifiers/nmj.py @@ -22,6 +22,7 @@ import telnetlib import re from sickbeard import logger +from sickbeard.exceptions import ex try: import xml.etree.cElementTree as etree @@ -44,7 +45,7 @@ class NMJNotifier: try: terminal = telnetlib.Telnet(host) except Exception: - logger.log(u"Warning: unable to get a telnet session to %s" % (host), logger.ERROR) + logger.log(u"Warning: unable to get a telnet session to %s" % (host), logger.WARNING) return False # tell the terminal to output the necessary info to the screen so we can search it later @@ -66,7 +67,7 @@ class NMJNotifier: logger.log(u"Found NMJ database %s on device %s" % (database, device), logger.DEBUG) sickbeard.NMJ_DATABASE = database else: - logger.log(u"Could not get current NMJ database on %s, NMJ is probably not running!" % (host), logger.ERROR) + logger.log(u"Could not get current NMJ database on %s, NMJ is probably not running!" % (host), logger.WARNING) return False # if the device is a remote host then try to parse the mounting URL and save it to the config @@ -79,7 +80,7 @@ class NMJNotifier: sickbeard.NMJ_MOUNT = mount else: logger.log(u"Detected a network share on the Popcorn Hour, but could not get the mounting url", - logger.DEBUG) + logger.WARNING) return False return True @@ -117,7 +118,13 @@ class NMJNotifier: logger.log(u"Try to mount network drive via url: %s" % (mount), logger.DEBUG) handle = urllib2.urlopen(req) except IOError, e: - logger.log(u"Warning: Couldn't contact popcorn hour on host %s: %s" % (host, e)) + if hasattr(e, 'reason'): + logger.log(u"NMJ: Could not contact Popcorn Hour on host %s: %s" % (host, e.reason), logger.WARNING) + elif hasattr(e, 'code'): + logger.log(u"NMJ: Problem with Popcorn Hour on host %s: %s" % (host, e.code), logger.WARNING) + return False + except Exception, e: + logger.log(u"NMJ: Unknown exception: " + ex(e), logger.ERROR) return False # build up the request URL and parameters @@ -126,7 +133,8 @@ class NMJNotifier: "arg0": "scanner_start", "arg1": database, "arg2": "background", - "arg3": ""} + "arg3": "" + } params = urllib.urlencode(params) updateUrl = UPDATE_URL % {"host": host, "params": params} @@ -137,7 +145,13 @@ class NMJNotifier: handle = urllib2.urlopen(req) response = handle.read() except IOError, e: - logger.log(u"Warning: Couldn't contact Popcorn Hour on host %s: %s" % (host, e)) + if hasattr(e, 'reason'): + logger.log(u"NMJ: Could not contact Popcorn Hour on host %s: %s" % (host, e.reason), logger.WARNING) + elif hasattr(e, 'code'): + logger.log(u"NMJ: Problem with Popcorn Hour on host %s: %s" % (host, e.code), logger.WARNING) + return False + except Exception, e: + logger.log(u"NMJ: Unknown exception: " + ex(e), logger.ERROR) return False # try to parse the resulting XML @@ -150,10 +164,10 @@ class NMJNotifier: # if the result was a number then consider that an error if int(result) > 0: - logger.log(u"Popcorn Hour returned an errorcode: %s" % (result)) + logger.log(u"Popcorn Hour returned an errorcode: %s" % (result), logger.ERROR) return False else: - logger.log(u"NMJ started background scan") + logger.log(u"NMJ started background scan", logger.MESSAGE) return True def _notifyNMJ(self, host=None, database=None, mount=None, force=False): diff --git a/sickbeard/notifiers/nmjv2.py b/sickbeard/notifiers/nmjv2.py index 355a4193..6b9b53f8 100644 --- a/sickbeard/notifiers/nmjv2.py +++ b/sickbeard/notifiers/nmjv2.py @@ -87,7 +87,7 @@ class NMJv2Notifier: return True except IOError, e: - logger.log(u"Warning: Couldn't contact popcorn hour on host %s: %s" % (host, e)) + logger.log(u"Warning: Couldn't contact popcorn hour on host %s: %s" % (host, e), logger.WARNING) return False return False @@ -105,7 +105,7 @@ class NMJv2Notifier: #if a host is provided then attempt to open a handle to that URL try: url_scandir = "http://" + host + ":8008/metadata_database?arg0=update_scandir&arg1=" + sickbeard.NMJv2_DATABASE + "&arg2=&arg3=update_all" - logger.log(u"NMJ scan update command send to host: %s" % (host)) + logger.log(u"NMJ scan update command sent to host: %s" % (host), logger.DEBUG) url_updatedb = "http://" + host + ":8008/metadata_database?arg0=scanner_start&arg1=" + sickbeard.NMJv2_DATABASE + "&arg2=background&arg3=" logger.log(u"Try to mount network drive via url: %s" % (host), logger.DEBUG) prereq = urllib2.Request(url_scandir) @@ -116,7 +116,7 @@ class NMJv2Notifier: handle2 = urllib2.urlopen(req) response2 = handle2.read() except IOError, e: - logger.log(u"Warning: Couldn't contact popcorn hour on host %s: %s" % (host, e)) + logger.log(u"Warning: Couldn't contact popcorn hour on host %s: %s" % (host, e), logger.WARNING) return False try: et = etree.fromstring(response1) @@ -142,15 +142,15 @@ class NMJv2Notifier: "Read only file system"] if int(result1) > 0: index = error_codes.index(result1) - logger.log(u"Popcorn Hour returned an error: %s" % (error_messages[index])) + logger.log(u"Popcorn Hour returned an error: %s" % (error_messages[index]), logger.ERROR) return False else: if int(result2) > 0: index = error_codes.index(result2) - logger.log(u"Popcorn Hour returned an error: %s" % (error_messages[index])) + logger.log(u"Popcorn Hour returned an error: %s" % (error_messages[index]), logger.ERROR) return False else: - logger.log(u"NMJv2 started background scan") + logger.log(u"NMJv2 started background scan", logger.MESSAGE) return True def _notifyNMJ(self, host=None, force=False): diff --git a/sickbeard/notifiers/plex.py b/sickbeard/notifiers/plex.py index 8047ab54..1e5cbb62 100644 --- a/sickbeard/notifiers/plex.py +++ b/sickbeard/notifiers/plex.py @@ -82,7 +82,7 @@ class PLEXNotifier(XBMCNotifier): if sickbeard.USE_PLEX and sickbeard.PLEX_UPDATE_LIBRARY: if not sickbeard.PLEX_SERVER_HOST: - logger.log(u"No Plex Server host specified, check your settings", logger.DEBUG) + logger.log(u"No Plex Media Server host specified, check your settings", logger.DEBUG) return False logger.log(u"Updating library for the Plex Media Server host: " + sickbeard.PLEX_SERVER_HOST, diff --git a/sickbeard/notifiers/prowl.py b/sickbeard/notifiers/prowl.py index 026a975c..ce2ecbad 100644 --- a/sickbeard/notifiers/prowl.py +++ b/sickbeard/notifiers/prowl.py @@ -65,11 +65,7 @@ class ProwlNotifier: title = "SickRage" - logger.log(u"Prowl title: " + title, logger.DEBUG) - logger.log(u"Prowl event: " + event, logger.DEBUG) - logger.log(u"Prowl message: " + message, logger.DEBUG) - logger.log(u"Prowl api: " + prowl_api, logger.DEBUG) - logger.log(u"Prowl priority: " + prowl_priority, logger.DEBUG) + logger.log("PROWL: Sending notice with details: event=\"%s\", message=\"%s\", priority=%s, api=%s" % (event, message, prowl_priority, prowl_api), logger.DEBUG) http_handler = HTTPSConnection("api.prowlapp.com") @@ -91,7 +87,7 @@ class ProwlNotifier: request_status = response.status if request_status == 200: - logger.log(u"Prowl notifications sent.", logger.DEBUG) + logger.log(u"Prowl notifications sent.", logger.MESSAGE) return True elif request_status == 401: logger.log(u"Prowl auth failed: %s" % response.reason, logger.ERROR) diff --git a/sickbeard/notifiers/pushover.py b/sickbeard/notifiers/pushover.py index 8fd5f468..ac0aabad 100644 --- a/sickbeard/notifiers/pushover.py +++ b/sickbeard/notifiers/pushover.py @@ -33,7 +33,7 @@ API_KEY = "awKfdt263PLaEWV9RXuSn4c46qoAyA" class PushoverNotifier: def test_notify(self, userKey=None): - return self._sendPushover("This is a test notification from SickRage", 'Test', userKey) + return self._notifyPushover("This is a test notification from SickRage", 'Test', userKey, force=True) def _sendPushover(self, msg, title, userKey=None): """ @@ -74,7 +74,7 @@ class PushoverNotifier: logger.log("Pushover notification failed." + ex(e), logger.ERROR) return False else: - logger.log("Pushover notification failed. Error code: " + str(e.code), logger.WARNING) + logger.log("Pushover notification failed. Error code: " + str(e.code), logger.ERROR) # HTTP status 404 if the provided email address isn't a Pushover user. if e.code == 404: @@ -98,7 +98,7 @@ class PushoverNotifier: logger.log("Wrong data sent to pushover", logger.ERROR) return False - logger.log("Pushover notification successful.", logger.DEBUG) + logger.log("Pushover notification successful.", logger.MESSAGE) return True def notify_snatch(self, ep_name, title=notifyStrings[NOTIFY_SNATCH]): @@ -114,24 +114,24 @@ class PushoverNotifier: if sickbeard.PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD: self._notifyPushover(title, ep_name + ": " + lang) - def _notifyPushover(self, title, message, userKey=None): + def _notifyPushover(self, title, message, userKey=None, force=False): """ Sends a pushover notification based on the provided info or SB config title: The title of the notification to send message: The message string to send userKey: The userKey to send the notification to + force: Enforce sending, for instance for testing """ - if not sickbeard.USE_PUSHOVER: + if not sickbeard.USE_PUSHOVER and not force: logger.log("Notification for Pushover not enabled, skipping this notification", logger.DEBUG) return False logger.log("Sending notification for " + message, logger.DEBUG) # self._sendPushover(message, title, userKey) - self._sendPushover(message, title) - return True + return self._sendPushover(message, title) notifier = PushoverNotifier diff --git a/sickbeard/notifiers/pytivo.py b/sickbeard/notifiers/pytivo.py index 1ae3ac8f..0afbab93 100644 --- a/sickbeard/notifiers/pytivo.py +++ b/sickbeard/notifiers/pytivo.py @@ -23,6 +23,7 @@ from urllib import urlencode from urllib2 import Request, urlopen, HTTPError from sickbeard import logger +from sickbeard.exceptions import ex from sickbeard import encodingKludge as ek @@ -81,7 +82,7 @@ class pyTivoNotifier: requestUrl = "http://" + host + "/TiVoConnect?" + urlencode( {'Command': 'Push', 'Container': container, 'File': file, 'tsn': tsn}) - logger.log(u"pyTivo notification: Requesting " + requestUrl) + logger.log(u"pyTivo notification: Requesting " + requestUrl, logger.DEBUG) request = Request(requestUrl) @@ -89,13 +90,14 @@ class pyTivoNotifier: response = urlopen(request) #@UnusedVariable except HTTPError , e: if hasattr(e, 'reason'): - logger.log(u"pyTivo notification: Error, failed to reach a server") - logger.log(u"'Error reason: " + e.reason) + logger.log(u"pyTivo notification: Error, failed to reach a server - " + e.reason, logger.ERROR) return False elif hasattr(e, 'code'): - logger.log(u"pyTivo notification: Error, the server couldn't fulfill the request") - logger.log(u"Error code: " + e.code) - return False + logger.log(u"pyTivo notification: Error, the server couldn't fulfill the request - ", + e.code, logger.ERROR) + return False + except Exception, e: + logger.log(u"PYTIVO: Unknown exception: " + ex(e), logger.ERROR) + return False else: logger.log(u"pyTivo notification: Successfully requested transfer of file") return True diff --git a/sickbeard/notifiers/synoindex.py b/sickbeard/notifiers/synoindex.py index dd78e1d2..96ff111f 100644 --- a/sickbeard/notifiers/synoindex.py +++ b/sickbeard/notifiers/synoindex.py @@ -48,7 +48,7 @@ class synoIndexNotifier: if sickbeard.USE_SYNOINDEX: synoindex_cmd = ['/usr/syno/bin/synoindex', '-N', ek.ek(os.path.abspath, new_path), ek.ek(os.path.abspath, old_path)] - logger.log(u"Executing command " + str(synoindex_cmd)) + logger.log(u"Executing command " + str(synoindex_cmd), logger.DEBUG) logger.log(u"Absolute path to command: " + ek.ek(os.path.abspath, synoindex_cmd[0]), logger.DEBUG) try: p = subprocess.Popen(synoindex_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -56,7 +56,7 @@ class synoIndexNotifier: out, err = p.communicate() #@UnusedVariable logger.log(u"Script result: " + str(out), logger.DEBUG) except OSError, e: - logger.log(u"Unable to run synoindex: " + ex(e)) + logger.log(u"Unable to run synoindex: " + ex(e), logger.ERROR) def deleteFolder(self, cur_path): self.makeObject('-D', cur_path) @@ -73,7 +73,7 @@ class synoIndexNotifier: def makeObject(self, cmd_arg, cur_path): if sickbeard.USE_SYNOINDEX: synoindex_cmd = ['/usr/syno/bin/synoindex', cmd_arg, ek.ek(os.path.abspath, cur_path)] - logger.log(u"Executing command " + str(synoindex_cmd)) + logger.log(u"Executing command " + str(synoindex_cmd), logger.DEBUG) logger.log(u"Absolute path to command: " + ek.ek(os.path.abspath, synoindex_cmd[0]), logger.DEBUG) try: p = subprocess.Popen(synoindex_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, @@ -81,7 +81,7 @@ class synoIndexNotifier: out, err = p.communicate() #@UnusedVariable logger.log(u"Script result: " + str(out), logger.DEBUG) except OSError, e: - logger.log(u"Unable to run synoindex: " + ex(e)) + logger.log(u"Unable to run synoindex: " + ex(e), logger.ERROR) notifier = synoIndexNotifier diff --git a/sickbeard/notifiers/tweet.py b/sickbeard/notifiers/tweet.py index aaa6fe2a..e010f7c0 100644 --- a/sickbeard/notifiers/tweet.py +++ b/sickbeard/notifiers/tweet.py @@ -61,12 +61,12 @@ class TwitterNotifier: oauth_consumer = oauth.Consumer(key=self.consumer_key, secret=self.consumer_secret) oauth_client = oauth.Client(oauth_consumer) - logger.log('Requesting temp token from Twitter') + logger.log('Requesting temp token from Twitter', logger.DEBUG) resp, content = oauth_client.request(self.REQUEST_TOKEN_URL, 'GET') if resp['status'] != '200': - logger.log('Invalid respond from Twitter requesting temp token: %s' % resp['status']) + logger.log('Invalid response from Twitter requesting temp token: %s' % resp['status'], logger.ERROR) else: request_token = dict(parse_qsl(content)) @@ -85,26 +85,26 @@ class TwitterNotifier: token = oauth.Token(request_token['oauth_token'], request_token['oauth_token_secret']) token.set_verifier(key) - logger.log('Generating and signing request for an access token using key ' + key) + logger.log('Generating and signing request for an access token using key ' + key, logger.DEBUG) signature_method_hmac_sha1 = oauth.SignatureMethod_HMAC_SHA1() #@UnusedVariable oauth_consumer = oauth.Consumer(key=self.consumer_key, secret=self.consumer_secret) - logger.log('oauth_consumer: ' + str(oauth_consumer)) + logger.log('oauth_consumer: ' + str(oauth_consumer), logger.DEBUG) oauth_client = oauth.Client(oauth_consumer, token) - logger.log('oauth_client: ' + str(oauth_client)) + logger.log('oauth_client: ' + str(oauth_client), logger.DEBUG) resp, content = oauth_client.request(self.ACCESS_TOKEN_URL, method='POST', body='oauth_verifier=%s' % key) - logger.log('resp, content: ' + str(resp) + ',' + str(content)) + logger.log('resp, content: ' + str(resp) + ',' + str(content), logger.DEBUG) access_token = dict(parse_qsl(content)) - logger.log('access_token: ' + str(access_token)) + logger.log('access_token: ' + str(access_token), logger.DEBUG) - logger.log('resp[status] = ' + str(resp['status'])) + logger.log('resp[status] = ' + str(resp['status']), logger.DEBUG) if resp['status'] != '200': logger.log('The request for a token with did not succeed: ' + str(resp['status']), logger.ERROR) return False else: - logger.log('Your Twitter Access Token key: %s' % access_token['oauth_token']) - logger.log('Access Token secret: %s' % access_token['oauth_token_secret']) + logger.log('Your Twitter Access Token key: %s' % access_token['oauth_token'], logger.DEBUG) + logger.log('Access Token secret: %s' % access_token['oauth_token_secret'], logger.DEBUG) sickbeard.TWITTER_USERNAME = access_token['oauth_token'] sickbeard.TWITTER_PASSWORD = access_token['oauth_token_secret'] return True @@ -117,7 +117,7 @@ class TwitterNotifier: access_token_key = sickbeard.TWITTER_USERNAME access_token_secret = sickbeard.TWITTER_PASSWORD - logger.log(u"Sending tweet: " + message) + logger.log(u"Sending tweet: " + message, logger.DEBUG) api = twitter.Api(username, password, access_token_key, access_token_secret) @@ -138,4 +138,4 @@ class TwitterNotifier: return self._send_tweet(prefix + ": " + message) -notifier = TwitterNotifier \ No newline at end of file +notifier = TwitterNotifier diff --git a/sickbeard/notifiers/xbmc.py b/sickbeard/notifiers/xbmc.py index 34d2be50..95084be3 100644 --- a/sickbeard/notifiers/xbmc.py +++ b/sickbeard/notifiers/xbmc.py @@ -66,7 +66,7 @@ class XBMCNotifier: 3 | (pre Eden) 4 | v11 (Eden) 5 | (pre Frodo) - 6 | v12 (Frodo) + 6 | v12 (Frodo) / v13 (Gotham) """ @@ -327,7 +327,7 @@ class XBMCNotifier: time.sleep(5) # do a full update if requested else: - logger.log(u"Doing Full Library XBMC update on host: " + host, logger.DEBUG) + logger.log(u"Doing Full Library XBMC update on host: " + host, logger.MESSAGE) updateCommand = {'command': 'ExecBuiltIn', 'parameter': 'XBMC.updatelibrary(video)'} request = self._send_to_xbmc(updateCommand, host)