mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 13:23:24 -07:00
Add posters to Pushover notifications
This commit is contained in:
parent
17dd767c22
commit
f9f05bbea3
1 changed files with 30 additions and 3 deletions
|
@ -2639,6 +2639,7 @@ class PUSHOVER(Notifier):
|
||||||
'priority': 0,
|
'priority': 0,
|
||||||
'sound': '',
|
'sound': '',
|
||||||
'incl_url': 1,
|
'incl_url': 1,
|
||||||
|
'incl_poster': 0,
|
||||||
'movie_provider': '',
|
'movie_provider': '',
|
||||||
'tv_provider': '',
|
'tv_provider': '',
|
||||||
'music_provider': ''
|
'music_provider': ''
|
||||||
|
@ -2651,7 +2652,12 @@ class PUSHOVER(Notifier):
|
||||||
'message': body.encode("utf-8"),
|
'message': body.encode("utf-8"),
|
||||||
'sound': self.config['sound'],
|
'sound': self.config['sound'],
|
||||||
'html': self.config['html_support'],
|
'html': self.config['html_support'],
|
||||||
'priority': self.config['priority']}
|
'priority': self.config['priority'],
|
||||||
|
'timestamp': int(time.time())}
|
||||||
|
|
||||||
|
headers = {'Content-type': 'application/x-www-form-urlencoded'}
|
||||||
|
|
||||||
|
files = {}
|
||||||
|
|
||||||
if self.config['incl_url'] and kwargs.get('parameters', {}).get('media_type'):
|
if self.config['incl_url'] and kwargs.get('parameters', {}).get('media_type'):
|
||||||
# Grab formatted metadata
|
# Grab formatted metadata
|
||||||
|
@ -2672,9 +2678,23 @@ class PUSHOVER(Notifier):
|
||||||
data['url'] = provider_link
|
data['url'] = provider_link
|
||||||
data['url_title'] = caption
|
data['url_title'] = caption
|
||||||
|
|
||||||
headers = {'Content-type': 'application/x-www-form-urlencoded'}
|
if self.config['incl_poster'] and kwargs.get('parameters', {}).get('media_type'):
|
||||||
|
# Grab formatted metadata
|
||||||
|
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
||||||
|
|
||||||
return self.make_request('https://api.pushover.net/1/messages.json', headers=headers, data=data)
|
# Retrieve the poster from Plex
|
||||||
|
result = pmsconnect.PmsConnect().get_image(img=pretty_metadata.parameters.get('poster_thumb', ''))
|
||||||
|
if result and result[0]:
|
||||||
|
poster_content = result[0]
|
||||||
|
else:
|
||||||
|
poster_content = ''
|
||||||
|
|
||||||
|
if poster_content:
|
||||||
|
title = pretty_metadata.get_title()
|
||||||
|
files = {'attachment': (title, poster_content, 'image/jpeg')}
|
||||||
|
headers = {}
|
||||||
|
|
||||||
|
return self.make_request('https://api.pushover.net/1/messages.json', headers=headers, data=data, files=files)
|
||||||
|
|
||||||
def get_sounds(self):
|
def get_sounds(self):
|
||||||
if self.config['api_token']:
|
if self.config['api_token']:
|
||||||
|
@ -2735,6 +2755,13 @@ class PUSHOVER(Notifier):
|
||||||
'description': 'Include a supplementary URL with the notifications.',
|
'description': 'Include a supplementary URL with the notifications.',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
},
|
},
|
||||||
|
{'label': 'Include Poster Image',
|
||||||
|
'value': self.config['incl_poster'],
|
||||||
|
'name': 'pushover_incl_poster',
|
||||||
|
'description': 'Include a poster with the notifications.<br>'
|
||||||
|
'Imgur upload may need to be enabled under the notifications settings tab.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
{'label': 'Movie Link Source',
|
{'label': 'Movie Link Source',
|
||||||
'value': self.config['movie_provider'],
|
'value': self.config['movie_provider'],
|
||||||
'name': 'pushover_movie_provider',
|
'name': 'pushover_movie_provider',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue