mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-30 03:28:31 -07:00
Add value3 to IFTTT notifications (Closes #1279)
This commit is contained in:
parent
b505286caf
commit
8407f27fed
1 changed files with 21 additions and 1 deletions
|
@ -54,6 +54,7 @@ import twitter
|
||||||
import pynma
|
import pynma
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
|
import common
|
||||||
import database
|
import database
|
||||||
import helpers
|
import helpers
|
||||||
import logger
|
import logger
|
||||||
|
@ -729,6 +730,13 @@ class PrettyMetadata(object):
|
||||||
def get_plex_url(self):
|
def get_plex_url(self):
|
||||||
return self.parameters['plex_url']
|
return self.parameters['plex_url']
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_parameters():
|
||||||
|
parameters = {param['value']: param['name']
|
||||||
|
for category in common.NOTIFICATION_PARAMETERS for param in category['parameters']}
|
||||||
|
parameters[''] = ''
|
||||||
|
return parameters
|
||||||
|
|
||||||
|
|
||||||
class Notifier(object):
|
class Notifier(object):
|
||||||
NAME = ''
|
NAME = ''
|
||||||
|
@ -1943,7 +1951,8 @@ class IFTTT(Notifier):
|
||||||
"""
|
"""
|
||||||
NAME = 'IFTTT'
|
NAME = 'IFTTT'
|
||||||
_DEFAULT_CONFIG = {'key': '',
|
_DEFAULT_CONFIG = {'key': '',
|
||||||
'event': 'tautulli'
|
'event': 'tautulli',
|
||||||
|
'value3': '',
|
||||||
}
|
}
|
||||||
|
|
||||||
def agent_notify(self, subject='', body='', action='', **kwargs):
|
def agent_notify(self, subject='', body='', action='', **kwargs):
|
||||||
|
@ -1952,6 +1961,10 @@ class IFTTT(Notifier):
|
||||||
data = {'value1': subject.encode("utf-8"),
|
data = {'value1': subject.encode("utf-8"),
|
||||||
'value2': body.encode("utf-8")}
|
'value2': body.encode("utf-8")}
|
||||||
|
|
||||||
|
if self.config['value3']:
|
||||||
|
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
||||||
|
data['value3'] = pretty_metadata.parameters.get(self.config['value3'], '')
|
||||||
|
|
||||||
headers = {'Content-type': 'application/json'}
|
headers = {'Content-type': 'application/json'}
|
||||||
|
|
||||||
return self.make_request('https://maker.ifttt.com/trigger/{}/with/key/{}'.format(event, self.config['key']),
|
return self.make_request('https://maker.ifttt.com/trigger/{}/with/key/{}'.format(event, self.config['key']),
|
||||||
|
@ -1975,6 +1988,13 @@ class IFTTT(Notifier):
|
||||||
' as <span class="inline-pre">value1</span>'
|
' as <span class="inline-pre">value1</span>'
|
||||||
' and <span class="inline-pre">value2</span> respectively.',
|
' and <span class="inline-pre">value2</span> respectively.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
|
},
|
||||||
|
{'label': 'Value 3',
|
||||||
|
'value': self.config['value3'],
|
||||||
|
'name': 'ifttt_value3',
|
||||||
|
'description': 'Optional: Select a parameter to send as <span class="inline-pre">value3</span>.',
|
||||||
|
'input_type': 'select',
|
||||||
|
'select_options': PrettyMetadata().get_parameters()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue