mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Update formatting for Slack poster notifications
This commit is contained in:
parent
2c2fbb8583
commit
748aad16d7
1 changed files with 33 additions and 38 deletions
|
@ -1993,20 +1993,26 @@ class SLACK(object):
|
||||||
poster_link = pretty_metadata.get_poster_link()
|
poster_link = pretty_metadata.get_poster_link()
|
||||||
caption = pretty_metadata.get_caption()
|
caption = pretty_metadata.get_caption()
|
||||||
title = pretty_metadata.get_title()
|
title = pretty_metadata.get_title()
|
||||||
|
subtitle = pretty_metadata.get_subtitle()
|
||||||
|
|
||||||
# Build Slack post attachment
|
# Build Slack post attachment
|
||||||
attachment = {}
|
attachment = {'fallback': 'Image for %s' % title,
|
||||||
if self.incl_pmslink:
|
'title': title,
|
||||||
caption = 'View on Plex Web'
|
'text': subtitle,
|
||||||
attachment['title_link'] = plex_url
|
'image_url': poster_url,
|
||||||
attachment['text'] = caption
|
'thumb_url': poster_url
|
||||||
elif poster_link:
|
}
|
||||||
attachment['title_link'] = poster_link
|
|
||||||
attachment['text'] = caption
|
|
||||||
|
|
||||||
attachment['fallback'] = 'Image for %s' % title
|
fields = []
|
||||||
attachment['title'] = title
|
if poster_link:
|
||||||
attachment['image_url'] = poster_url
|
attachment['title_link'] = poster_link
|
||||||
|
fields.append({'value': '<%s|%s>' % (poster_link, caption),
|
||||||
|
'short': True})
|
||||||
|
if self.incl_pmslink:
|
||||||
|
fields.append({'value': '<%s|%s>' % (plex_url, 'View on Plex Web'),
|
||||||
|
'short': True})
|
||||||
|
if fields:
|
||||||
|
attachment['fields'] = fields
|
||||||
|
|
||||||
data['attachments'] = [attachment]
|
data['attachments'] = [attachment]
|
||||||
|
|
||||||
|
@ -2398,7 +2404,7 @@ class FacebookNotifier(object):
|
||||||
attachment = {}
|
attachment = {}
|
||||||
|
|
||||||
if self.incl_poster and 'metadata' in kwargs:
|
if self.incl_poster and 'metadata' in kwargs:
|
||||||
# Grab formatted metadata
|
# Grab formatted metadata
|
||||||
pretty_metadata = PrettyMetadata(kwargs['metadata'])
|
pretty_metadata = PrettyMetadata(kwargs['metadata'])
|
||||||
poster_url = pretty_metadata.get_poster_url()
|
poster_url = pretty_metadata.get_poster_url()
|
||||||
plex_url = pretty_metadata.get_plex_url()
|
plex_url = pretty_metadata.get_plex_url()
|
||||||
|
@ -2409,9 +2415,8 @@ class FacebookNotifier(object):
|
||||||
|
|
||||||
# Build Facebook post attachment
|
# Build Facebook post attachment
|
||||||
if self.incl_pmslink:
|
if self.incl_pmslink:
|
||||||
caption = 'View on Plex Web'
|
|
||||||
attachment['link'] = plex_url
|
attachment['link'] = plex_url
|
||||||
attachment['caption'] = caption
|
attachment['caption'] = 'View on Plex Web'
|
||||||
elif poster_link:
|
elif poster_link:
|
||||||
attachment['link'] = poster_link
|
attachment['link'] = poster_link
|
||||||
attachment['caption'] = caption
|
attachment['caption'] = caption
|
||||||
|
@ -2756,35 +2761,25 @@ class HIPCHAT(object):
|
||||||
card = {'title': title,
|
card = {'title': title,
|
||||||
'format': 'medium',
|
'format': 'medium',
|
||||||
'style': 'application',
|
'style': 'application',
|
||||||
'id': uuid.uuid4().hex}
|
'id': uuid.uuid4().hex,
|
||||||
description = {'format': 'text',
|
'activity': {'html': text,
|
||||||
'value': subtitle}
|
'icon': {'url': poster_url}},
|
||||||
card['description'] = description
|
'description': {'format': 'text',
|
||||||
thumbnail = {'url': poster_url}
|
'value': subtitle},
|
||||||
card['thumbnail'] = thumbnail
|
'thumbnail': {'url': poster_url}
|
||||||
|
}
|
||||||
|
|
||||||
attributes = []
|
attributes = []
|
||||||
|
|
||||||
if self.incl_pmslink:
|
|
||||||
pms_values = {'label': 'View on Plex Web',
|
|
||||||
'url': plex_url}
|
|
||||||
plex_web = {'value': pms_values}
|
|
||||||
attributes.append(plex_web)
|
|
||||||
|
|
||||||
if poster_link:
|
if poster_link:
|
||||||
card['url'] = poster_link
|
card['url'] = poster_link
|
||||||
info_values = {'label': caption,
|
attributes.append({'value': {'label': caption,
|
||||||
'url': poster_link}
|
'url': poster_link}})
|
||||||
content_info_web = {'value': info_values}
|
if self.incl_pmslink:
|
||||||
attributes.append(content_info_web)
|
attributes.append({'value': {'label': 'View on Plex Web',
|
||||||
|
'url': plex_url}})
|
||||||
if len(attributes):
|
if attributes:
|
||||||
card['attributes'] = attributes
|
card['attributes'] = attributes
|
||||||
|
|
||||||
act_icon = {'url': poster_url}
|
|
||||||
activity = {'html': text,
|
|
||||||
'icon': act_icon}
|
|
||||||
card['activity'] = activity
|
|
||||||
|
|
||||||
data['message'] = text
|
data['message'] = text
|
||||||
data['card'] = card
|
data['card'] = card
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue