mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Add dropdown for Pushover sounds
This commit is contained in:
parent
c12862ffba
commit
7d3d2957c3
3 changed files with 41 additions and 11 deletions
|
@ -90,9 +90,18 @@ from plexpy import helpers
|
||||||
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
|
||||||
})
|
})
|
||||||
|
|
||||||
var notificationConfig = $("#set_notification_config");
|
|
||||||
$('#save-notification-item').click(function() {
|
$('#save-notification-item').click(function() {
|
||||||
doAjaxCall('set_notification_config', $(this), 'tabs', true);
|
doAjaxCall('set_notification_config', $(this), 'tabs', true);
|
||||||
|
// Reload modal to update certain fields
|
||||||
|
$.ajax({
|
||||||
|
url: 'get_notification_agent_config',
|
||||||
|
data: { config_id: '${config_id}' },
|
||||||
|
cache: false,
|
||||||
|
async: true,
|
||||||
|
complete: function (xhr, status) {
|
||||||
|
$("#notification-config-modal").html(xhr.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -905,11 +905,31 @@ class PUSHOVER(object):
|
||||||
|
|
||||||
self.notify('Main Screen Activate', 'Test Message')
|
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', {})
|
||||||
|
return sounds
|
||||||
|
elif request_status >= 400 and request_status < 500:
|
||||||
|
logger.info(u"Unable to retrieve Pushover notification sounds: %s" % response.reason)
|
||||||
|
return {}
|
||||||
|
else:
|
||||||
|
logger.info(u"Unable to retrieve Pushover notification sounds.")
|
||||||
|
return {}
|
||||||
|
|
||||||
def return_config_options(self):
|
def return_config_options(self):
|
||||||
config_option = [{'label': 'Pushover API Key',
|
sounds = self.get_sounds()
|
||||||
|
sounds[''] = ''
|
||||||
|
|
||||||
|
config_option = [{'label': 'Pushover User Key',
|
||||||
'value': self.keys,
|
'value': self.keys,
|
||||||
'name': 'pushover_keys',
|
'name': 'pushover_keys',
|
||||||
'description': 'Your Pushover API key.',
|
'description': 'Your Pushover user key.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Priority',
|
{'label': 'Priority',
|
||||||
|
@ -922,13 +942,14 @@ class PUSHOVER(object):
|
||||||
{'label': 'Sound',
|
{'label': 'Sound',
|
||||||
'value': self.sound,
|
'value': self.sound,
|
||||||
'name': 'pushover_sound',
|
'name': 'pushover_sound',
|
||||||
'description': 'Set the notification sound (choose from <a href="https://pushover.net/api#sounds" target="_blank">this list</a> or leave blank for default)',
|
'description': 'Set the notification sound. Leave blank for the default sound.',
|
||||||
'input_type': 'text'
|
'input_type': 'select',
|
||||||
|
'select_options': sounds
|
||||||
},
|
},
|
||||||
{'label': 'Pushover API Token',
|
{'label': 'Pushover API Token',
|
||||||
'value': plexpy.CONFIG.PUSHOVER_APITOKEN,
|
'value': plexpy.CONFIG.PUSHOVER_APITOKEN,
|
||||||
'name': 'pushover_apitoken',
|
'name': 'pushover_apitoken',
|
||||||
'description': 'Your Pushover API toekn. Leave blank to use PlexPy default.',
|
'description': 'Your Pushover API token. Leave blank to use PlexPy default.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -1305,7 +1305,7 @@ class WebInterface(object):
|
||||||
checkboxes = {'email_tls': checked(plexpy.CONFIG.EMAIL_TLS)}
|
checkboxes = {'email_tls': checked(plexpy.CONFIG.EMAIL_TLS)}
|
||||||
|
|
||||||
return serve_template(templatename="notification_config.html", title="Notification Configuration",
|
return serve_template(templatename="notification_config.html", title="Notification Configuration",
|
||||||
data=config, checkboxes=checkboxes)
|
config_id=config_id, data=config, checkboxes=checkboxes)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def get_notification_agent_triggers(self, config_id, **kwargs):
|
def get_notification_agent_triggers(self, config_id, **kwargs):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue