1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

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)
This commit is contained in:
Nils Vogels 2014-05-29 02:30:38 +02:00
parent 894e533330
commit 0e34c8c4b3
15 changed files with 97 additions and 88 deletions

View File

@ -19,9 +19,9 @@
<form id="configForm" action="saveNotifications" method="post">
<div id="config-components">
<ul>
<li><a href="#tabs-1">Home Theater</a></li>
<li><a href="#tabs-1">Home Theater / NAS</a></li>
<li><a href="#tabs-2">Devices</a></li>
<li><a href="#tabs-3">Online</a></li>
<li><a href="#tabs-3">Social</a></li>
</ul>
<div id="tabs-1">
@ -381,7 +381,8 @@
<div class="component-group clearfix">
<div class="component-group-desc">
<h3><a href="http://synology.com/" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href, '_blank'); return false;"><img src="$sbRoot/images/notifiers/synoindex.png" alt="" title="Synology Indexer"/> Synology Indexer </a></h3>
<h3><a href="http://synology.com/" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href, '_blank'); return false;"><img src="$sbRoot/images/notifiers/synoindex.png" alt="" title="Synology"/> Synology </a></h3>
<p>The Synology DiskStation NAS.</p>
<p>Synology Indexer is the daemon running on the Synology NAS to build its media database.</p>
</div>
@ -390,7 +391,7 @@
<input type="checkbox" class="enabler" name="use_synoindex" id="use_synoindex" #if $sickbeard.USE_SYNOINDEX then "checked=\"checked\"" else ""# />
<label class="clearfix" for="use_synoindex">
<span class="component-title">Enable</span>
<span class="component-desc">Should SickRage send notifications to the synoindex daemon?<br /><br />
<span class="component-desc">Should SickRage send Synology notifications?<br /><br />
</span>
</label>
<label class="nocheck clearfix" for="use_synoindex">
@ -457,7 +458,7 @@
<div class="component-group clearfix">
<div class="component-group-desc">
<h3><a href="http://pytivo.sourceforge.net/wiki/index.php/PyTivo" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href, '_blank'); return false;"><img src="$sbRoot/images/notifiers/pytivo.png" alt="" title="pyTivo"/> pyTivo </a></h3>
<p>pyTivo is both an HMO and GoBack server. This notifier will load the completed downloads to your Tivo.</p>
<p>pyTivo is both an HMO and GoBack server. This notifier will load the completed downloads to your Tivo.</p>
</div>
<fieldset class="component-group-list">
<div class="field-pair">
@ -708,7 +709,7 @@
<input type="checkbox" class="enabler" name="use_pushover" id="use_pushover" #if $sickbeard.USE_PUSHOVER then "checked=\"checked\"" else ""# />
<label class="clearfix" for="use_pushover">
<span class="component-title">Enable</span>
<span class="component-desc">Should SickRage send notifications through Pushover?</span>
<span class="component-desc">Should SickRage send Pushover notifications?</span>
</label>
</div>
@ -755,14 +756,14 @@
<div class="component-group clearfix">
<div class="component-group-desc">
<h3><a href="http://boxcar.io/" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href, '_blank'); return false;"><img src="$sbRoot/images/notifiers/boxcar.png" alt="" title="Boxcar"/> Boxcar </a></h3>
<p>Read your messages where and when you want them! A subscription will be send if needed.</p>
<p>Universal push notification for iOS. Read your messages where and when you want them! A subscription will be sent if needed.</p>
</div>
<fieldset class="component-group-list">
<div class="field-pair">
<input type="checkbox" class="enabler" name="use_boxcar" id="use_boxcar" #if $sickbeard.USE_BOXCAR then "checked=\"checked\"" else ""# />
<label class="clearfix" for="use_boxcar">
<span class="component-title">Enable</span>
<span class="component-desc">Should SickRage send notifications through Boxcar?</span>
<span class="component-desc">Should SickRage send Boxcar notifications?</span>
</label>
</div>
@ -816,7 +817,7 @@
<input type="checkbox" class="enabler" name="use_boxcar2" id="use_boxcar2" #if $sickbeard.USE_BOXCAR2 then "checked=\"checked\"" else ""# />
<label class="clearfix" for="use_boxcar2">
<span class="component-title">Enable</span>
<span class="component-desc">Should SickRage send notifications through Boxcar2?</span>
<span class="component-desc">Should SickRage Boxcar2 notifications?</span>
</label>
</div>
@ -940,7 +941,7 @@
<input type="checkbox" class="enabler" name="use_pushalot" id="use_pushalot" #if $sickbeard.USE_PUSHALOT then "checked=\"checked\"" else ""# />
<label class="clearfix" for="use_pushalot">
<span class="component-title">Enable</span>
<span class="component-desc">Should SickRage send notifications through Pushalot?</span>
<span class="component-desc">Should SickRage send Pushalot notifications?</span>
</label>
</div>
@ -994,7 +995,7 @@
<input type="checkbox" class="enabler" name="use_pushbullet" id="use_pushbullet" #if $sickbeard.USE_PUSHBULLET then "checked=\"checked\"" else ""# />
<label class="clearfix" for="use_pushbullet">
<span class="component-title">Enable</span>
<span class="component-desc">Should SickRage send notifications through Pushbullet?</span>
<span class="component-desc">Should SickRage send Pushbullet notifications?</span>
</label>
</div>

View File

@ -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()

View File

@ -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

View File

@ -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
notifier = GrowlNotifier

View File

@ -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

View File

@ -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
notifier = NMA_Notifier

View File

@ -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):

View File

@ -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):

View File

@ -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,

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
notifier = TwitterNotifier

View File

@ -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)