mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Rename config_id to agent_id
This commit is contained in:
parent
322f106e75
commit
c90dd147bb
5 changed files with 75 additions and 75 deletions
|
@ -132,7 +132,7 @@ from plexpy import helpers
|
|||
function reloadModal() {
|
||||
$.ajax({
|
||||
url: 'get_notification_agent_config',
|
||||
data: { config_id: '${agent["id"]}' },
|
||||
data: { agent_id: '${agent["id"]}' },
|
||||
cache: false,
|
||||
async: true,
|
||||
complete: function (xhr, status) {
|
||||
|
@ -195,7 +195,7 @@ from plexpy import helpers
|
|||
$.ajax({
|
||||
url: 'test_notifier',
|
||||
data: {
|
||||
config_id: '${agent["id"]}',
|
||||
agent_id: '${agent["id"]}',
|
||||
subject: $('#test_subject').val(),
|
||||
body: $('#test_body').val(),
|
||||
script: $('#test_script').val(),
|
||||
|
|
|
@ -1721,10 +1721,10 @@ $(document).ready(function() {
|
|||
|
||||
// Load notification agent config modal
|
||||
$(".toggle-notification-config-modal").click(function() {
|
||||
var configId = $(this).data('id');
|
||||
var agent_id = $(this).data('id');
|
||||
$.ajax({
|
||||
url: 'get_notification_agent_config',
|
||||
data: { config_id: configId },
|
||||
data: { agent_id: agent_id },
|
||||
cache: false,
|
||||
async: true,
|
||||
complete: function(xhr, status) {
|
||||
|
@ -1735,10 +1735,10 @@ $(document).ready(function() {
|
|||
|
||||
// Load notification triggers config modal
|
||||
$(".toggle-notification-triggers-modal").click(function() {
|
||||
var configId = $(this).data('id');
|
||||
var agent_id = $(this).data('id');
|
||||
$.ajax({
|
||||
url: 'get_notification_agent_triggers',
|
||||
data: { config_id: configId },
|
||||
data: { agent_id: agent_id },
|
||||
cache: false,
|
||||
async: true,
|
||||
complete: function(xhr, status) {
|
||||
|
|
|
@ -49,7 +49,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
if agent['on_play'] and notify_action == 'play':
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -62,7 +62,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
and (plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < plexpy.CONFIG.NOTIFY_WATCHED_PERCENT):
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -74,7 +74,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
and (plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < 99):
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -86,7 +86,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
and (plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < 99):
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -97,7 +97,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
elif agent['on_buffer'] and notify_action == 'buffer':
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -113,7 +113,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
if not any(d['agent_id'] == agent['id'] for d in notify_states):
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -128,7 +128,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
if not notify_state['on_watched'] and (notify_state['agent_id'] == agent['id']):
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -143,7 +143,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
if agent['on_play'] and notify_action == 'play':
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -155,7 +155,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
elif agent['on_stop'] and notify_action == 'stop':
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -167,7 +167,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
elif agent['on_pause'] and notify_action == 'pause':
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -179,7 +179,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
elif agent['on_resume'] and notify_action == 'resume':
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -191,7 +191,7 @@ def notify(stream_data=None, notify_action=None):
|
|||
elif agent['on_buffer'] and notify_action == 'buffer':
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(session=stream_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -215,7 +215,7 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||
if agent['on_created'] and notify_action == 'created':
|
||||
# Build and send notification
|
||||
notify_strings = build_notify_text(timeline=timeline_data, state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -228,7 +228,7 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||
if agent['on_extdown'] and notify_action == 'extdown':
|
||||
# Build and send notification
|
||||
notify_strings = build_server_notify_text(state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -236,7 +236,7 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||
if agent['on_intdown'] and notify_action == 'intdown':
|
||||
# Build and send notification
|
||||
notify_strings = build_server_notify_text(state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -244,7 +244,7 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||
if agent['on_extup'] and notify_action == 'extup':
|
||||
# Build and send notification
|
||||
notify_strings = build_server_notify_text(state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
@ -252,7 +252,7 @@ def notify_timeline(timeline_data=None, notify_action=None):
|
|||
if agent['on_intup'] and notify_action == 'intup':
|
||||
# Build and send notification
|
||||
notify_strings = build_server_notify_text(state=notify_action)
|
||||
notifiers.send_notification(config_id=agent['id'],
|
||||
notifiers.send_notification(agent_id=agent['id'],
|
||||
subject=notify_strings[0],
|
||||
body=notify_strings[1],
|
||||
notify_action=notify_action,
|
||||
|
|
|
@ -358,59 +358,59 @@ def available_notification_agents():
|
|||
return agents
|
||||
|
||||
|
||||
def get_notification_agent_config(config_id):
|
||||
if str(config_id).isdigit():
|
||||
config_id = int(config_id)
|
||||
def get_notification_agent_config(agent_id):
|
||||
if str(agent_id).isdigit():
|
||||
agent_id = int(agent_id)
|
||||
|
||||
if config_id == 0:
|
||||
if agent_id == 0:
|
||||
growl = GROWL()
|
||||
return growl.return_config_options()
|
||||
elif config_id == 1:
|
||||
elif agent_id == 1:
|
||||
prowl = PROWL()
|
||||
return prowl.return_config_options()
|
||||
elif config_id == 2:
|
||||
elif agent_id == 2:
|
||||
xbmc = XBMC()
|
||||
return xbmc.return_config_options()
|
||||
elif config_id == 3:
|
||||
elif agent_id == 3:
|
||||
plex = Plex()
|
||||
return plex.return_config_options()
|
||||
elif config_id == 4:
|
||||
elif agent_id == 4:
|
||||
nma = NMA()
|
||||
return nma.return_config_options()
|
||||
elif config_id == 5:
|
||||
elif agent_id == 5:
|
||||
pushalot = PUSHALOT()
|
||||
return pushalot.return_config_options()
|
||||
elif config_id == 6:
|
||||
elif agent_id == 6:
|
||||
pushbullet = PUSHBULLET()
|
||||
return pushbullet.return_config_options()
|
||||
elif config_id == 7:
|
||||
elif agent_id == 7:
|
||||
pushover = PUSHOVER()
|
||||
return pushover.return_config_options()
|
||||
elif config_id == 8:
|
||||
elif agent_id == 8:
|
||||
osx_notify = OSX_NOTIFY()
|
||||
return osx_notify.return_config_options()
|
||||
elif config_id == 9:
|
||||
elif agent_id == 9:
|
||||
boxcar = BOXCAR()
|
||||
return boxcar.return_config_options()
|
||||
elif config_id == 10:
|
||||
elif agent_id == 10:
|
||||
email = Email()
|
||||
return email.return_config_options()
|
||||
elif config_id == 11:
|
||||
elif agent_id == 11:
|
||||
tweet = TwitterNotifier()
|
||||
return tweet.return_config_options()
|
||||
elif config_id == 12:
|
||||
elif agent_id == 12:
|
||||
iftttClient = IFTTT()
|
||||
return iftttClient.return_config_options()
|
||||
elif config_id == 13:
|
||||
elif agent_id == 13:
|
||||
telegramClient = TELEGRAM()
|
||||
return telegramClient.return_config_options()
|
||||
elif config_id == 14:
|
||||
elif agent_id == 14:
|
||||
slackClient = SLACK()
|
||||
return slackClient.return_config_options()
|
||||
elif config_id == 15:
|
||||
elif agent_id == 15:
|
||||
script = Scripts()
|
||||
return script.return_config_options()
|
||||
elif config_id == 16:
|
||||
elif agent_id == 16:
|
||||
facebook = FacebookNotifier()
|
||||
return facebook.return_config_options()
|
||||
else:
|
||||
|
@ -419,59 +419,59 @@ def get_notification_agent_config(config_id):
|
|||
return []
|
||||
|
||||
|
||||
def send_notification(config_id, subject, body, **kwargs):
|
||||
if str(config_id).isdigit():
|
||||
config_id = int(config_id)
|
||||
def send_notification(agent_id, subject, body, **kwargs):
|
||||
if str(agent_id).isdigit():
|
||||
agent_id = int(agent_id)
|
||||
|
||||
if config_id == 0:
|
||||
if agent_id == 0:
|
||||
growl = GROWL()
|
||||
growl.notify(message=body, event=subject)
|
||||
elif config_id == 1:
|
||||
elif agent_id == 1:
|
||||
prowl = PROWL()
|
||||
prowl.notify(message=body, event=subject)
|
||||
elif config_id == 2:
|
||||
elif agent_id == 2:
|
||||
xbmc = XBMC()
|
||||
xbmc.notify(subject=subject, message=body)
|
||||
elif config_id == 3:
|
||||
elif agent_id == 3:
|
||||
plex = Plex()
|
||||
plex.notify(subject=subject, message=body)
|
||||
elif config_id == 4:
|
||||
elif agent_id == 4:
|
||||
nma = NMA()
|
||||
nma.notify(subject=subject, message=body)
|
||||
elif config_id == 5:
|
||||
elif agent_id == 5:
|
||||
pushalot = PUSHALOT()
|
||||
pushalot.notify(message=body, event=subject)
|
||||
elif config_id == 6:
|
||||
elif agent_id == 6:
|
||||
pushbullet = PUSHBULLET()
|
||||
pushbullet.notify(message=body, subject=subject)
|
||||
elif config_id == 7:
|
||||
elif agent_id == 7:
|
||||
pushover = PUSHOVER()
|
||||
pushover.notify(message=body, event=subject)
|
||||
elif config_id == 8:
|
||||
elif agent_id == 8:
|
||||
osx_notify = OSX_NOTIFY()
|
||||
osx_notify.notify(title=subject, text=body)
|
||||
elif config_id == 9:
|
||||
elif agent_id == 9:
|
||||
boxcar = BOXCAR()
|
||||
boxcar.notify(title=subject, message=body)
|
||||
elif config_id == 10:
|
||||
elif agent_id == 10:
|
||||
email = Email()
|
||||
email.notify(subject=subject, message=body)
|
||||
elif config_id == 11:
|
||||
elif agent_id == 11:
|
||||
tweet = TwitterNotifier()
|
||||
tweet.notify(subject=subject, message=body)
|
||||
elif config_id == 12:
|
||||
elif agent_id == 12:
|
||||
iftttClient = IFTTT()
|
||||
iftttClient.notify(subject=subject, message=body)
|
||||
elif config_id == 13:
|
||||
elif agent_id == 13:
|
||||
telegramClient = TELEGRAM()
|
||||
telegramClient.notify(message=body, event=subject)
|
||||
elif config_id == 14:
|
||||
elif agent_id == 14:
|
||||
slackClient = SLACK()
|
||||
slackClient.notify(message=body, event=subject)
|
||||
elif config_id == 15:
|
||||
elif agent_id == 15:
|
||||
scripts = Scripts()
|
||||
scripts.notify(message=body, subject=subject, **kwargs)
|
||||
elif config_id == 16:
|
||||
elif agent_id == 16:
|
||||
facebook = FacebookNotifier()
|
||||
facebook.notify(subject=subject, message=body)
|
||||
else:
|
||||
|
|
|
@ -1321,12 +1321,12 @@ class WebInterface(object):
|
|||
raise cherrypy.HTTPRedirect("settings")
|
||||
|
||||
@cherrypy.expose
|
||||
def get_notification_agent_config(self, config_id, **kwargs):
|
||||
if config_id.isdigit():
|
||||
config = notifiers.get_notification_agent_config(config_id=config_id)
|
||||
def get_notification_agent_config(self, agent_id, **kwargs):
|
||||
if agent_id.isdigit():
|
||||
config = notifiers.get_notification_agent_config(agent_id=agent_id)
|
||||
agents = notifiers.available_notification_agents()
|
||||
for agent in agents:
|
||||
if int(config_id) == agent['id']:
|
||||
if int(agent_id) == agent['id']:
|
||||
this_agent = agent
|
||||
break
|
||||
else:
|
||||
|
@ -1340,11 +1340,11 @@ class WebInterface(object):
|
|||
agent=this_agent, data=config, checkboxes=checkboxes)
|
||||
|
||||
@cherrypy.expose
|
||||
def get_notification_agent_triggers(self, config_id, **kwargs):
|
||||
if config_id.isdigit():
|
||||
def get_notification_agent_triggers(self, agent_id, **kwargs):
|
||||
if agent_id.isdigit():
|
||||
agents = notifiers.available_notification_agents()
|
||||
for agent in agents:
|
||||
if int(config_id) == agent['id']:
|
||||
if int(agent_id) == agent['id']:
|
||||
this_agent = agent
|
||||
break
|
||||
else:
|
||||
|
@ -1357,13 +1357,13 @@ class WebInterface(object):
|
|||
|
||||
@cherrypy.expose
|
||||
@addtoapi('notify')
|
||||
def test_notifier(self, config_id=None, subject='PlexPy', body='Test notification', **kwargs):
|
||||
def test_notifier(self, agent_id=None, subject='PlexPy', body='Test notification', **kwargs):
|
||||
cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store"
|
||||
|
||||
if config_id.isdigit():
|
||||
if agent_id.isdigit():
|
||||
agents = notifiers.available_notification_agents()
|
||||
for agent in agents:
|
||||
if int(config_id) == agent['id']:
|
||||
if int(agent_id) == agent['id']:
|
||||
this_agent = agent
|
||||
break
|
||||
else:
|
||||
|
@ -1374,8 +1374,8 @@ class WebInterface(object):
|
|||
notifiers.send_notification(this_agent['id'], subject, body, **kwargs)
|
||||
return "Notification sent."
|
||||
else:
|
||||
logger.debug(u"Unable to send test notification, invalid notification agent ID %s." % config_id)
|
||||
return "Invalid notification agent ID %s." % config_id
|
||||
logger.debug(u"Unable to send test notification, invalid notification agent ID %s." % agent_id)
|
||||
return "Invalid notification agent ID %s." % agent_id
|
||||
else:
|
||||
logger.debug(u"Unable to send test notification, no notification agent ID received.")
|
||||
return "No notification agent ID received."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue