diff --git a/data/interfaces/default/notification_config.html b/data/interfaces/default/notification_config.html index 0267f478..286ac1b0 100644 --- a/data/interfaces/default/notification_config.html +++ b/data/interfaces/default/notification_config.html @@ -158,12 +158,7 @@ from plexpy import helpers }); }); - $('#testSlack').click(function() { - $.get("/test_slack", function(data) { $('#ajaxMsg').html("" + data); }); - $('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut(); - }); - - $('#pushbullet_apikey').on('change', function () { + $('#pushbullet_apikey, #pushover_apitoken').on('change', function () { doAjaxCall('set_notification_config', $(this), 'tabs', true); reloadModal(); return false; diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 87cfaefa..1c06d2a2 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -983,15 +983,11 @@ class PUSHOVER(object): def __init__(self): self.enabled = plexpy.CONFIG.PUSHOVER_ENABLED + self.application_token = plexpy.CONFIG.PUSHOVER_APITOKEN self.keys = plexpy.CONFIG.PUSHOVER_KEYS self.priority = plexpy.CONFIG.PUSHOVER_PRIORITY self.sound = plexpy.CONFIG.PUSHOVER_SOUND - if plexpy.CONFIG.PUSHOVER_APITOKEN: - self.application_token = plexpy.CONFIG.PUSHOVER_APITOKEN - else: - self.application_token = "aVny3NZFwZaXC642c831b4wd7KUhQS" - def conf(self, options): return cherrypy.config['config'].get('Pushover', options) @@ -1041,25 +1037,35 @@ class PUSHOVER(object): self.notify('Main Screen Activate', 'Test Message') def get_sounds(self): - http_handler = HTTPSConnection("api.pushover.net") - http_handler.request("GET", "/1/sounds.json?token=" + self.application_token) - response = http_handler.getresponse() - request_status = response.status - - if request_status == 200: - data = json.loads(response.read()) - sounds = data.get('sounds', {}) - sounds.update({'': ''}) - return sounds - elif request_status >= 400 and request_status < 500: - logger.info(u"Unable to retrieve Pushover notification sounds list: %s" % response.reason) - return {'': ''} + if plexpy.CONFIG.PUSHOVER_APITOKEN: + http_handler = HTTPSConnection("api.pushover.net") + http_handler.request("GET", "/1/sounds.json?token=" + self.application_token) + response = http_handler.getresponse() + request_status = response.status + + if request_status == 200: + data = json.loads(response.read()) + sounds = data.get('sounds', {}) + sounds.update({'': ''}) + return sounds + elif request_status >= 400 and request_status < 500: + logger.info(u"Unable to retrieve Pushover notification sounds list: %s" % response.reason) + return {'': ''} + else: + logger.info(u"Unable to retrieve Pushover notification sounds list.") + return {'': ''} + else: - logger.info(u"Unable to retrieve Pushover notification sounds list.") return {'': ''} def return_config_options(self): - config_option = [{'label': 'Pushover User or Group Key', + config_option = [{'label': 'Pushover API Token', + 'value': plexpy.CONFIG.PUSHOVER_APITOKEN, + 'name': 'pushover_apitoken', + 'description': 'Your Pushover API token.', + 'input_type': 'text' + }, + {'label': 'Pushover User or Group Key', 'value': self.keys, 'name': 'pushover_keys', 'description': 'Your Pushover user or group key.', @@ -1078,12 +1084,6 @@ class PUSHOVER(object): 'description': 'Set the notification sound. Leave blank for the default sound.', 'input_type': 'select', 'select_options': self.get_sounds() - }, - {'label': 'Pushover API Token', - 'value': plexpy.CONFIG.PUSHOVER_APITOKEN, - 'name': 'pushover_apitoken', - 'description': 'Your Pushover API token. Leave blank to use PlexPy default.', - 'input_type': 'text' } ] diff --git a/plexpy/webserve.py b/plexpy/webserve.py index a9eaae6c..39bc34aa 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -554,8 +554,8 @@ class WebInterface(object): # Get new server URLs for SSL communications. plextv.get_real_pms_url() - - # Get new server friendly name + + # Get new server friendly name pmsconnect.get_server_friendly_name() # Reconfigure scheduler if intervals changed