mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 01:32:57 -07:00
Add test notification for all agents
This commit is contained in:
parent
1e616fa585
commit
f31c4dcccd
3 changed files with 59 additions and 52 deletions
|
@ -659,6 +659,30 @@ class WebInterface(object):
|
|||
|
||||
return a.fetchData()
|
||||
|
||||
@cherrypy.expose
|
||||
def test_notifier(self, config_id=None, subject='PlexPy', body='Test notification', **kwargs):
|
||||
cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store"
|
||||
|
||||
if config_id.isdigit():
|
||||
agents = notifiers.available_notification_agents()
|
||||
for agent in agents:
|
||||
if int(config_id) == agent['id']:
|
||||
this_agent = agent
|
||||
break
|
||||
else:
|
||||
this_agent = None
|
||||
|
||||
if this_agent:
|
||||
logger.debug("Sending test %s notification." % this_agent['name'])
|
||||
notifiers.send_notification(this_agent['id'], subject, body)
|
||||
return "Notification sent."
|
||||
else:
|
||||
logger.debug("Unable to send test notification, invalid notification agent ID %s." % config_id)
|
||||
return "Invalid notification agent ID %s." % config_id
|
||||
else:
|
||||
logger.debug("Unable to send test notification, no notification agent ID received.")
|
||||
return "No notification agent ID received."
|
||||
|
||||
@cherrypy.expose
|
||||
def twitterStep1(self):
|
||||
cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store"
|
||||
|
@ -676,37 +700,6 @@ class WebInterface(object):
|
|||
else:
|
||||
return "Unable to verify key"
|
||||
|
||||
@cherrypy.expose
|
||||
def testTwitter(self):
|
||||
cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store"
|
||||
tweet = notifiers.TwitterNotifier()
|
||||
result = tweet.test_notify()
|
||||
if result:
|
||||
return "Tweet successful, check your twitter to make sure it worked"
|
||||
else:
|
||||
return "Error sending tweet"
|
||||
|
||||
@cherrypy.expose
|
||||
def test_ifttt(self):
|
||||
cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store"
|
||||
event = notifiers.IFTTT()
|
||||
result = event.test()
|
||||
if result:
|
||||
return "Notification successful."
|
||||
else:
|
||||
return "Error sending event."
|
||||
|
||||
@cherrypy.expose
|
||||
def test_slack(self):
|
||||
cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store"
|
||||
event = notifiers.SLACK()
|
||||
result = event.test()
|
||||
|
||||
if result:
|
||||
return "Notification successful."
|
||||
else:
|
||||
return "Error sending event."
|
||||
|
||||
@cherrypy.expose
|
||||
def osxnotifyregister(self, app):
|
||||
cherrypy.response.headers['Cache-Control'] = "max-age=0,no-cache,no-store"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue