mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 21:51:14 -07:00
Add supplementary URL option to Pushover
This commit is contained in:
parent
1c087ec856
commit
62d05e5e08
2 changed files with 32 additions and 2 deletions
|
@ -436,6 +436,8 @@ _CONFIG_DEFINITIONS = {
|
|||
'PUSHOVER_APITOKEN': (str, 'Pushover', ''),
|
||||
'PUSHOVER_ENABLED': (int, 'Pushover', 0),
|
||||
'PUSHOVER_HTML_SUPPORT': (int, 'Pushover', 1),
|
||||
'PUSHOVER_INCL_PMSLINK': (int, 'Pushover', 0),
|
||||
'PUSHOVER_INCL_URL': (int, 'Pushover', 1),
|
||||
'PUSHOVER_KEYS': (str, 'Pushover', ''),
|
||||
'PUSHOVER_PRIORITY': (int, 'Pushover', 0),
|
||||
'PUSHOVER_SOUND': (str, 'Pushover', ''),
|
||||
|
|
|
@ -575,7 +575,7 @@ def send_notification(agent_id, subject, body, notify_action, **kwargs):
|
|||
return pushbullet.notify(message=body, subject=subject)
|
||||
elif agent_id == 7:
|
||||
pushover = PUSHOVER()
|
||||
return pushover.notify(message=body, event=subject)
|
||||
return pushover.notify(message=body, event=subject, **kwargs)
|
||||
elif agent_id == 8:
|
||||
osx_notify = OSX_NOTIFY()
|
||||
return osx_notify.notify(title=subject, text=body)
|
||||
|
@ -1263,11 +1263,13 @@ class PUSHOVER(object):
|
|||
self.html_support = plexpy.CONFIG.PUSHOVER_HTML_SUPPORT
|
||||
self.priority = plexpy.CONFIG.PUSHOVER_PRIORITY
|
||||
self.sound = plexpy.CONFIG.PUSHOVER_SOUND
|
||||
self.incl_pmslink = plexpy.CONFIG.PUSHOVER_INCL_PMSLINK
|
||||
self.incl_url = plexpy.CONFIG.PUSHOVER_INCL_URL
|
||||
|
||||
def conf(self, options):
|
||||
return cherrypy.config['config'].get('Pushover', options)
|
||||
|
||||
def notify(self, message, event):
|
||||
def notify(self, message, event, **kwargs):
|
||||
if not message or not event:
|
||||
return
|
||||
|
||||
|
@ -1281,6 +1283,20 @@ class PUSHOVER(object):
|
|||
'html': self.html_support,
|
||||
'priority': self.priority}
|
||||
|
||||
if self.incl_url and 'metadata' in kwargs:
|
||||
# Grab formatted metadata
|
||||
pretty_metadata = PrettyMetadata(kwargs['metadata'])
|
||||
plex_url = pretty_metadata.get_plex_url()
|
||||
poster_link = pretty_metadata.get_poster_link()
|
||||
caption = pretty_metadata.get_caption()
|
||||
|
||||
if self.incl_pmslink:
|
||||
data['url'] = plex_url
|
||||
data['url_title'] = 'View on Plex Web'
|
||||
else:
|
||||
data['url'] = poster_link
|
||||
data['url_title'] = caption
|
||||
|
||||
http_handler.request("POST",
|
||||
"/1/messages.json",
|
||||
headers={'Content-type': "application/x-www-form-urlencoded"},
|
||||
|
@ -1368,6 +1384,18 @@ class PUSHOVER(object):
|
|||
'name': 'pushover_html_support',
|
||||
'description': 'Style your messages using these HTML tags: b, i, u, a[href], font[color]',
|
||||
'input_type': 'checkbox'
|
||||
},
|
||||
{'label': 'Include supplementary URL',
|
||||
'value': self.incl_url,
|
||||
'name': 'pushover_incl_url',
|
||||
'description': 'Include a supplementary URL to IMDB, TVDB, TMDb, or Last.fm with the notifications.',
|
||||
'input_type': 'checkbox'
|
||||
},
|
||||
{'label': 'Supplementary URL to Plex Web',
|
||||
'value': self.incl_pmslink,
|
||||
'name': 'pushover_incl_pmslink',
|
||||
'description': 'Enable to change the supplementary URL to the media in Plex Web.',
|
||||
'input_type': 'checkbox'
|
||||
}
|
||||
]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue