diff --git a/gui/slick/interfaces/default/config_notifications.tmpl b/gui/slick/interfaces/default/config_notifications.tmpl
index a67adfbb..e5d52633 100644
--- a/gui/slick/interfaces/default/config_notifications.tmpl
+++ b/gui/slick/interfaces/default/config_notifications.tmpl
@@ -745,6 +745,16 @@
User key of your Pushover account
+
+
+
+
Click below to test.
diff --git a/gui/slick/js/configNotifications.js b/gui/slick/js/configNotifications.js
index 8a390d3c..df03d5d3 100644
--- a/gui/slick/js/configNotifications.js
+++ b/gui/slick/js/configNotifications.js
@@ -57,7 +57,8 @@ $(document).ready(function(){
$('#testPushover').click(function() {
$('#testPushover-result').html(loading);
var pushover_userkey = $("#pushover_userkey").val();
- $.get(sbRoot + "/home/testPushover", {'userKey': pushover_userkey},
+ var pushover_apikey = $("#pushover_apikey").val();
+ $.get(sbRoot + "/home/testPushover", {'userKey': pushover_userkey, 'apiKey': pushover_apikey},
function (data) { $('#testPushover-result').html(data); });
});
diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py
index 98c684d5..7576b5e9 100644
--- a/sickbeard/__init__.py
+++ b/sickbeard/__init__.py
@@ -313,6 +313,7 @@ PUSHOVER_NOTIFY_ONSNATCH = False
PUSHOVER_NOTIFY_ONDOWNLOAD = False
PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD = False
PUSHOVER_USERKEY = None
+PUSHOVER_APIKEY = None
USE_LIBNOTIFY = False
LIBNOTIFY_NOTIFY_ONSNATCH = False
@@ -463,7 +464,7 @@ def initialize(consoleLogging=True):
EXTRA_SCRIPTS, USE_TWITTER, TWITTER_USERNAME, TWITTER_PASSWORD, TWITTER_PREFIX, DAILYSEARCH_FREQUENCY, \
USE_BOXCAR, BOXCAR_USERNAME, BOXCAR_PASSWORD, BOXCAR_NOTIFY_ONDOWNLOAD, BOXCAR_NOTIFY_ONSUBTITLEDOWNLOAD, BOXCAR_NOTIFY_ONSNATCH, \
USE_BOXCAR2, BOXCAR2_ACCESSTOKEN, BOXCAR2_NOTIFY_ONDOWNLOAD, BOXCAR2_NOTIFY_ONSUBTITLEDOWNLOAD, BOXCAR2_NOTIFY_ONSNATCH, \
- USE_PUSHOVER, PUSHOVER_USERKEY, PUSHOVER_NOTIFY_ONDOWNLOAD, PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHOVER_NOTIFY_ONSNATCH, \
+ USE_PUSHOVER, PUSHOVER_USERKEY, PUSHOVER_APIKEY, PUSHOVER_NOTIFY_ONDOWNLOAD, PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD, PUSHOVER_NOTIFY_ONSNATCH, \
USE_LIBNOTIFY, LIBNOTIFY_NOTIFY_ONSNATCH, LIBNOTIFY_NOTIFY_ONDOWNLOAD, LIBNOTIFY_NOTIFY_ONSUBTITLEDOWNLOAD, USE_NMJ, NMJ_HOST, NMJ_DATABASE, NMJ_MOUNT, USE_NMJv2, NMJv2_HOST, NMJv2_DATABASE, NMJv2_DBLOC, USE_SYNOINDEX, \
USE_SYNOLOGYNOTIFIER, SYNOLOGYNOTIFIER_NOTIFY_ONSNATCH, SYNOLOGYNOTIFIER_NOTIFY_ONDOWNLOAD, SYNOLOGYNOTIFIER_NOTIFY_ONSUBTITLEDOWNLOAD, \
USE_EMAIL, EMAIL_HOST, EMAIL_PORT, EMAIL_TLS, EMAIL_USER, EMAIL_PASSWORD, EMAIL_FROM, EMAIL_NOTIFY_ONSNATCH, EMAIL_NOTIFY_ONDOWNLOAD, EMAIL_NOTIFY_ONSUBTITLEDOWNLOAD, EMAIL_LIST, \
@@ -754,7 +755,7 @@ def initialize(consoleLogging=True):
PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD = bool(
check_setting_int(CFG, 'Pushover', 'pushover_notify_onsubtitledownload', 0))
PUSHOVER_USERKEY = check_setting_str(CFG, 'Pushover', 'pushover_userkey', '')
-
+ PUSHOVER_APIKEY = check_setting_str(CFG, 'Pushover', 'pushover_apikey', '')
USE_LIBNOTIFY = bool(check_setting_int(CFG, 'Libnotify', 'use_libnotify', 0))
LIBNOTIFY_NOTIFY_ONSNATCH = bool(check_setting_int(CFG, 'Libnotify', 'libnotify_notify_onsnatch', 0))
LIBNOTIFY_NOTIFY_ONDOWNLOAD = bool(check_setting_int(CFG, 'Libnotify', 'libnotify_notify_ondownload', 0))
@@ -1650,6 +1651,7 @@ def save_config():
new_config['Pushover']['pushover_notify_ondownload'] = int(PUSHOVER_NOTIFY_ONDOWNLOAD)
new_config['Pushover']['pushover_notify_onsubtitledownload'] = int(PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD)
new_config['Pushover']['pushover_userkey'] = PUSHOVER_USERKEY
+ new_config['Pushover']['pushover_apikey'] = PUSHOVER_APIKEY
new_config['Libnotify'] = {}
new_config['Libnotify']['use_libnotify'] = int(USE_LIBNOTIFY)
diff --git a/sickbeard/notifiers/pushover.py b/sickbeard/notifiers/pushover.py
index ac0aabad..3024f243 100644
--- a/sickbeard/notifiers/pushover.py
+++ b/sickbeard/notifiers/pushover.py
@@ -28,14 +28,13 @@ from sickbeard.common import notifyStrings, NOTIFY_SNATCH, NOTIFY_DOWNLOAD, NOTI
from sickbeard.exceptions import ex
API_URL = "https://api.pushover.net/1/messages.json"
-API_KEY = "awKfdt263PLaEWV9RXuSn4c46qoAyA"
class PushoverNotifier:
- def test_notify(self, userKey=None):
- return self._notifyPushover("This is a test notification from SickRage", 'Test', userKey, force=True)
+ def test_notify(self, userKey=None, apiKey=None):
+ return self._notifyPushover("This is a test notification from SickRage", 'Test', userKey, apiKey, force=True)
- def _sendPushover(self, msg, title, userKey=None):
+ def _sendPushover(self, msg, title, userKey=None, apiKey=None):
"""
Sends a pushover notification to the address provided
@@ -46,15 +45,20 @@ class PushoverNotifier:
returns: True if the message succeeded, False otherwise
"""
- if not userKey:
+ if userKey == None:
userKey = sickbeard.PUSHOVER_USERKEY
+ if apiKey == None:
+ apiKey = sickbeard.PUSHOVER_APIKEY
+
+ logger.log("Pushover API KEY in use: " + apiKey, logger.DEBUG)
+
# build up the URL and parameters
msg = msg.strip()
curUrl = API_URL
data = urllib.urlencode({
- 'token': API_KEY,
+ 'token': apiKey,
'title': title,
'user': userKey,
'message': msg.encode('utf-8'),
@@ -85,7 +89,7 @@ class PushoverNotifier:
elif e.code == 401:
#HTTP status 401 if the user doesn't have the service added
- subscribeNote = self._sendPushover(msg, title, userKey)
+ subscribeNote = self._sendPushover(msg, title, userKey, apiKey)
if subscribeNote:
logger.log("Subscription send", logger.DEBUG)
return True
@@ -98,6 +102,11 @@ class PushoverNotifier:
logger.log("Wrong data sent to pushover", logger.ERROR)
return False
+ # If you receive a HTTP status code of 429, it is because the message limit has been reached (free limit is 7,500)
+ elif e.code == 429:
+ logger.log("Pushover API message limit reached - try a different API key", logger.ERROR)
+ return False
+
logger.log("Pushover notification successful.", logger.MESSAGE)
return True
@@ -114,7 +123,7 @@ class PushoverNotifier:
if sickbeard.PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD:
self._notifyPushover(title, ep_name + ": " + lang)
- def _notifyPushover(self, title, message, userKey=None, force=False):
+ def _notifyPushover(self, title, message, userKey=None, apiKey=None, force=False):
"""
Sends a pushover notification based on the provided info or SB config
@@ -130,8 +139,8 @@ class PushoverNotifier:
logger.log("Sending notification for " + message, logger.DEBUG)
- # self._sendPushover(message, title, userKey)
- return self._sendPushover(message, title)
+ # self._sendPushover(message, title, userKey, apiKey)
+ return self._sendPushover(message, title, userKey, apiKey)
notifier = PushoverNotifier
diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py
index 86e1433f..ae983a79 100644
--- a/sickbeard/webserve.py
+++ b/sickbeard/webserve.py
@@ -2177,7 +2177,7 @@ class ConfigNotifications(MainHandler):
use_boxcar2=None, boxcar2_notify_onsnatch=None, boxcar2_notify_ondownload=None,
boxcar2_notify_onsubtitledownload=None, boxcar2_accesstoken=None,
use_pushover=None, pushover_notify_onsnatch=None, pushover_notify_ondownload=None,
- pushover_notify_onsubtitledownload=None, pushover_userkey=None,
+ pushover_notify_onsubtitledownload=None, pushover_userkey=None, pushover_apikey=None,
use_libnotify=None, libnotify_notify_onsnatch=None, libnotify_notify_ondownload=None,
libnotify_notify_onsubtitledownload=None,
use_nmj=None, nmj_host=None, nmj_database=None, nmj_mount=None, use_synoindex=None,
@@ -2262,6 +2262,7 @@ class ConfigNotifications(MainHandler):
sickbeard.PUSHOVER_NOTIFY_ONDOWNLOAD = config.checkbox_to_value(pushover_notify_ondownload)
sickbeard.PUSHOVER_NOTIFY_ONSUBTITLEDOWNLOAD = config.checkbox_to_value(pushover_notify_onsubtitledownload)
sickbeard.PUSHOVER_USERKEY = pushover_userkey
+ sickbeard.PUSHOVER_APIKEY = pushover_apikey
sickbeard.USE_LIBNOTIFY = config.checkbox_to_value(use_libnotify)
sickbeard.LIBNOTIFY_NOTIFY_ONSNATCH = config.checkbox_to_value(libnotify_notify_onsnatch)
@@ -3113,10 +3114,10 @@ class Home(MainHandler):
return "Error sending Boxcar2 notification"
- def testPushover(self, userKey=None):
+ def testPushover(self, userKey=None, apiKey=None):
self.set_header('Cache-Control', "max-age=0,no-cache,no-store")
- result = notifiers.pushover_notifier.test_notify(userKey)
+ result = notifiers.pushover_notifier.test_notify(userKey, apiKey)
if result:
return "Pushover notification succeeded. Check your Pushover clients to make sure it worked"
else: