mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 05:13:21 -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
|
@ -1198,12 +1198,6 @@ class TwitterNotifier(object):
|
|||
'description': 'Step 3: Verify the key.',
|
||||
'input_type': 'button'
|
||||
},
|
||||
{'label': 'Test Twitter',
|
||||
'value': 'Test Twitter',
|
||||
'name': 'testTwitter',
|
||||
'description': 'Test if Twitter notifications are working. See logs for troubleshooting.',
|
||||
'input_type': 'button'
|
||||
},
|
||||
{'input_type': 'nosave'
|
||||
}
|
||||
]
|
||||
|
@ -1522,12 +1516,6 @@ class IFTTT(object):
|
|||
'description': 'The Ifttt maker event to fire. The notification subject and body will be sent'
|
||||
' as value1 and value2 respectively.',
|
||||
'input_type': 'text'
|
||||
},
|
||||
{'label': 'Test Event',
|
||||
'value': 'Test Event',
|
||||
'name': 'testIFTTT',
|
||||
'description': 'Test if IFTTT notifications are working. See logs for troubleshooting.',
|
||||
'input_type': 'button'
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -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