Slack option to use thumbnail

This commit is contained in:
JonnyWong16 2017-02-02 21:34:51 -08:00
parent e49517ef05
commit 3e67177f73

View file

@ -2471,6 +2471,7 @@ class SLACK(Notifier):
'incl_subject': 1, 'incl_subject': 1,
'incl_card': 0, 'incl_card': 0,
'incl_description': 1, 'incl_description': 1,
'incl_thumbnail': 0,
'incl_pmslink': 0 'incl_pmslink': 0
} }
@ -2507,14 +2508,17 @@ class SLACK(Notifier):
# Build Slack post attachment # Build Slack post attachment
attachment = {'fallback': 'Image for %s' % title, attachment = {'fallback': 'Image for %s' % title,
'title': title, 'title': title
'image_url': poster_url,
'thumb_url': poster_url
} }
if self.config['color'] and re.match(r'^#(?:[0-9a-fA-F]{3}){1,2}$', self.config['color']): if self.config['color'] and re.match(r'^#(?:[0-9a-fA-F]{3}){1,2}$', self.config['color']):
attachment['color'] = self.config['color'] attachment['color'] = self.config['color']
if self.config['incl_thumbnail']:
attachment['thumb_url'] = poster_url
else:
attachment['image_url'] = poster_url
if self.config['incl_description'] or media_type in ('artist', 'album', 'track'): if self.config['incl_description'] or media_type in ('artist', 'album', 'track'):
attachment['text'] = description attachment['text'] = description
@ -2610,6 +2614,12 @@ class SLACK(Notifier):
'name': 'slack_incl_pmslink', 'name': 'slack_incl_pmslink',
'description': 'Include a second link to the media in Plex Web on the info card.', 'description': 'Include a second link to the media in Plex Web on the info card.',
'input_type': 'checkbox' 'input_type': 'checkbox'
},
{'label': 'Use Poster Thumbnail',
'value': self.config['incl_thumbnail'],
'name': 'slack_incl_thumbnail',
'description': 'Use a thumbnail instead of a full sized poster on the info card.',
'input_type': 'checkbox'
} }
] ]