mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 12:59:42 -07:00
Update Discord, Facebook, Hipchat, and Slack info cards
* Add option to hide plot summaries
This commit is contained in:
parent
07a1136839
commit
957c7aeab9
1 changed files with 179 additions and 123 deletions
|
@ -607,12 +607,12 @@ class PrettyMetadata(object):
|
||||||
title = '%s - %s' % (self.parameters['artist_name'], self.parameters['track_name'])
|
title = '%s - %s' % (self.parameters['artist_name'], self.parameters['track_name'])
|
||||||
return title.encode("utf-8")
|
return title.encode("utf-8")
|
||||||
|
|
||||||
def get_subtitle(self):
|
def get_description(self):
|
||||||
if self.media_type == 'track':
|
if self.media_type == 'track':
|
||||||
subtitle = self.parameters['album_name']
|
description = self.parameters['album_name']
|
||||||
else:
|
else:
|
||||||
subtitle = self.parameters['summary']
|
description = self.parameters['summary']
|
||||||
return subtitle.encode("utf-8")
|
return description.encode("utf-8")
|
||||||
|
|
||||||
def get_plex_url(self):
|
def get_plex_url(self):
|
||||||
return self.parameters['plex_url']
|
return self.parameters['plex_url']
|
||||||
|
@ -799,9 +799,11 @@ class DISCORD(Notifier):
|
||||||
'avatar_url': '',
|
'avatar_url': '',
|
||||||
'color': '',
|
'color': '',
|
||||||
'tts': 0,
|
'tts': 0,
|
||||||
'incl_pmslink': 0,
|
'incl_subject': 1,
|
||||||
'incl_poster': 0,
|
'incl_card': 0,
|
||||||
'incl_subject': 1
|
'incl_description': 1,
|
||||||
|
'incl_thumbnail': 0,
|
||||||
|
'incl_pmslink': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
def notify(self, subject='', body='', action='', **kwargs):
|
def notify(self, subject='', body='', action='', **kwargs):
|
||||||
|
@ -821,26 +823,33 @@ class DISCORD(Notifier):
|
||||||
if self.config['tts']:
|
if self.config['tts']:
|
||||||
data['tts'] = True
|
data['tts'] = True
|
||||||
|
|
||||||
if self.config['incl_poster'] and kwargs.get('parameters', {}).get('media_type'):
|
if self.config['incl_card'] and kwargs.get('parameters', {}).get('media_type'):
|
||||||
# Grab formatted metadata
|
# Grab formatted metadata
|
||||||
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
||||||
|
media_type = pretty_metadata.media_type
|
||||||
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()
|
||||||
provider = pretty_metadata.get_provider()
|
provider = pretty_metadata.get_provider()
|
||||||
provider_link = pretty_metadata.get_provider_link()
|
provider_link = pretty_metadata.get_provider_link()
|
||||||
title = pretty_metadata.get_title('\xc2\xb7'.decode('utf8'))
|
title = pretty_metadata.get_title('\xc2\xb7'.decode('utf8'))
|
||||||
subtitle = pretty_metadata.get_subtitle()
|
description = pretty_metadata.get_description()
|
||||||
|
|
||||||
# Build Discord post attachment
|
# Build Discord post attachment
|
||||||
attachment = {'title': title,
|
attachment = {'title': title
|
||||||
'description': subtitle,
|
|
||||||
'thumbnail': {'url': poster_url}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.config['color'] and self.config['color'].startswith('#'):
|
if self.config['color'] and self.config['color'].startswith('#'):
|
||||||
hex = self.config['color'].lstrip('#')
|
hex = self.config['color'].lstrip('#')
|
||||||
attachment['color'] = helpers.hex_to_int(hex)
|
attachment['color'] = helpers.hex_to_int(hex)
|
||||||
|
|
||||||
|
if self.config['incl_thumbnail']:
|
||||||
|
attachment['thumbnail'] = {'url': poster_url}
|
||||||
|
else:
|
||||||
|
attachment['image'] = {'url': poster_url}
|
||||||
|
|
||||||
|
if self.config['incl_description'] or media_type in ('artist', 'album', 'track'):
|
||||||
|
attachment['description'] = description
|
||||||
|
|
||||||
fields = []
|
fields = []
|
||||||
if provider_link:
|
if provider_link:
|
||||||
attachment['url'] = provider_link
|
attachment['url'] = provider_link
|
||||||
|
@ -912,23 +921,34 @@ class DISCORD(Notifier):
|
||||||
'description': 'Send the notification using text-to-speech.',
|
'description': 'Send the notification using text-to-speech.',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
},
|
},
|
||||||
{'label': 'Include Poster Image',
|
{'label': 'Include Subject Line',
|
||||||
'value': self.config['incl_poster'],
|
'value': self.config['incl_subject'],
|
||||||
'name': 'discord_incl_poster',
|
'name': 'discord_incl_subject',
|
||||||
'description': 'Include a poster with the notifications.',
|
'description': 'Include the subject line with the notifications.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Rich Metadata Info',
|
||||||
|
'value': self.config['incl_card'],
|
||||||
|
'name': 'discord_incl_card',
|
||||||
|
'description': 'Include an info card with a poster and metadata with the notifications.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Plot Summaries',
|
||||||
|
'value': self.config['incl_description'],
|
||||||
|
'name': 'discord_incl_description',
|
||||||
|
'description': 'Include a plot summary for movies and TV shows on the info card.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Use Poster Thumbnail',
|
||||||
|
'value': self.config['incl_thumbnail'],
|
||||||
|
'name': 'discord_incl_thumbnail',
|
||||||
|
'description': 'Use a thumbnail instead of a full sized poster on the info card.',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
},
|
},
|
||||||
{'label': 'Include Link to Plex Web',
|
{'label': 'Include Link to Plex Web',
|
||||||
'value': self.config['incl_pmslink'],
|
'value': self.config['incl_pmslink'],
|
||||||
'name': 'discord_incl_pmslink',
|
'name': 'discord_incl_pmslink',
|
||||||
'description': 'Include a link to the media in Plex Web with the notifications.<br>'
|
'description': 'Include a second link to the media in Plex Web on the info card.',
|
||||||
'If disabled, the link will go to IMDB, TVDB, TMDb, or Last.fm instead, if available.',
|
|
||||||
'input_type': 'checkbox'
|
|
||||||
},
|
|
||||||
{'label': 'Include Subject Line',
|
|
||||||
'value': self.config['incl_subject'],
|
|
||||||
'name': 'discord_incl_subject',
|
|
||||||
'description': 'Include the subject line with the notifications.',
|
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1078,9 +1098,10 @@ class FACEBOOK(Notifier):
|
||||||
'app_id': '',
|
'app_id': '',
|
||||||
'app_secret': '',
|
'app_secret': '',
|
||||||
'group_id': '',
|
'group_id': '',
|
||||||
'incl_pmslink': 0,
|
'incl_subject': 1,
|
||||||
'incl_poster': 0,
|
'incl_card': 0,
|
||||||
'incl_subject': 1
|
'incl_description': 1,
|
||||||
|
'incl_pmslink': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_authorization(self, app_id='', app_secret='', redirect_uri=''):
|
def _get_authorization(self, app_id='', app_secret='', redirect_uri=''):
|
||||||
|
@ -1150,15 +1171,16 @@ class FACEBOOK(Notifier):
|
||||||
|
|
||||||
attachment = {}
|
attachment = {}
|
||||||
|
|
||||||
if self.config['incl_poster'] and kwargs.get('parameters', {}).get('media_type'):
|
if self.config['incl_card'] and kwargs.get('parameters', {}).get('media_type'):
|
||||||
# Grab formatted metadata
|
# Grab formatted metadata
|
||||||
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
||||||
|
media_type = pretty_metadata.media_type
|
||||||
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()
|
||||||
provider_link = pretty_metadata.get_provider_link()
|
provider_link = pretty_metadata.get_provider_link()
|
||||||
caption = pretty_metadata.get_caption()
|
caption = pretty_metadata.get_caption()
|
||||||
title = pretty_metadata.get_title('\xc2\xb7'.decode('utf8'))
|
title = pretty_metadata.get_title('\xc2\xb7'.decode('utf8'))
|
||||||
subtitle = pretty_metadata.get_subtitle()
|
description = pretty_metadata.get_description()
|
||||||
|
|
||||||
# Build Facebook post attachment
|
# Build Facebook post attachment
|
||||||
if self.config['incl_pmslink']:
|
if self.config['incl_pmslink']:
|
||||||
|
@ -1172,7 +1194,11 @@ class FACEBOOK(Notifier):
|
||||||
|
|
||||||
attachment['picture'] = poster_url
|
attachment['picture'] = poster_url
|
||||||
attachment['name'] = title
|
attachment['name'] = title
|
||||||
attachment['description'] = subtitle
|
|
||||||
|
if self.config['incl_description'] or media_type in ('artist', 'album', 'track'):
|
||||||
|
attachment['description'] = description
|
||||||
|
else:
|
||||||
|
attachment['description'] = ' '
|
||||||
|
|
||||||
if self.config['incl_subject']:
|
if self.config['incl_subject']:
|
||||||
return self._post_facebook(subject + '\r\n' + body, attachment=attachment)
|
return self._post_facebook(subject + '\r\n' + body, attachment=attachment)
|
||||||
|
@ -1191,7 +1217,7 @@ class FACEBOOK(Notifier):
|
||||||
Step 6: Fill in the <strong>App ID</strong> and <strong>App Secret</strong> below.<br>\
|
Step 6: Fill in the <strong>App ID</strong> and <strong>App Secret</strong> below.<br>\
|
||||||
Step 7: Click the <strong>Request Authorization</strong> button below to retrieve your access token.<br>\
|
Step 7: Click the <strong>Request Authorization</strong> button below to retrieve your access token.<br>\
|
||||||
Step 8: Fill in your <strong>Access Token</strong> below if it is not filled in automatically.<br>\
|
Step 8: Fill in your <strong>Access Token</strong> below if it is not filled in automatically.<br>\
|
||||||
Step 9: Fill in your <strong>Group ID</strong> below.',
|
Step 9: Fill in your <strong>Group ID</strong> number below. It can be found in the URL of your group page.',
|
||||||
'input_type': 'help'
|
'input_type': 'help'
|
||||||
},
|
},
|
||||||
{'label': 'PlexPy URL',
|
{'label': 'PlexPy URL',
|
||||||
|
@ -1231,24 +1257,30 @@ class FACEBOOK(Notifier):
|
||||||
'description': 'Your Facebook Group ID.',
|
'description': 'Your Facebook Group ID.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Include Poster Image',
|
{'label': 'Include Subject Line',
|
||||||
'value': self.config['incl_poster'],
|
'value': self.config['incl_subject'],
|
||||||
'name': 'facebook_incl_poster',
|
'name': 'facebook_incl_subject',
|
||||||
'description': 'Include a poster with the notifications.',
|
'description': 'Include the subject line with the notifications.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Rich Metadata Info',
|
||||||
|
'value': self.config['incl_card'],
|
||||||
|
'name': 'facebook_incl_card',
|
||||||
|
'description': 'Include an info card with a poster and metadata with the notifications.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Plot Summaries',
|
||||||
|
'value': self.config['incl_description'],
|
||||||
|
'name': 'facebook_incl_description',
|
||||||
|
'description': 'Include a plot summary for movies and TV shows on the info card.',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
},
|
},
|
||||||
{'label': 'Include Link to Plex Web',
|
{'label': 'Include Link to Plex Web',
|
||||||
'value': self.config['incl_pmslink'],
|
'value': self.config['incl_pmslink'],
|
||||||
'name': 'facebook_incl_pmslink',
|
'name': 'facebook_incl_pmslink',
|
||||||
'description': 'Include a link to the media in Plex Web with the notifications.<br>'
|
'description': 'Include a link to the media in Plex Web on the info card.<br>'
|
||||||
'If disabled, the link will go to IMDB, TVDB, TMDb, or Last.fm instead, if available.',
|
'If disabled, the link will go to IMDB, TVDB, TMDb, or Last.fm instead, if available.',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
},
|
|
||||||
{'label': 'Include Subject Line',
|
|
||||||
'value': self.config['incl_subject'],
|
|
||||||
'name': 'facebook_incl_subject',
|
|
||||||
'description': 'Include the subject line with the notifications.',
|
|
||||||
'input_type': 'checkbox'
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1349,9 +1381,10 @@ class HIPCHAT(Notifier):
|
||||||
_DEFAULT_CONFIG = {'api_url': '',
|
_DEFAULT_CONFIG = {'api_url': '',
|
||||||
'color': '',
|
'color': '',
|
||||||
'emoticon': '',
|
'emoticon': '',
|
||||||
'incl_pmslink': 0,
|
'incl_subject': 1,
|
||||||
'incl_poster': 0,
|
'incl_card': 0,
|
||||||
'incl_subject': 1
|
'incl_description': 1,
|
||||||
|
'incl_pmslink': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
def notify(self, subject='', body='', action='', **kwargs):
|
def notify(self, subject='', body='', action='', **kwargs):
|
||||||
|
@ -1368,30 +1401,33 @@ class HIPCHAT(Notifier):
|
||||||
if self.config['color']:
|
if self.config['color']:
|
||||||
data['color'] = self.config['color']
|
data['color'] = self.config['color']
|
||||||
|
|
||||||
if self.config['incl_poster'] and kwargs.get('parameters', {}).get('media_type'):
|
if self.config['incl_card'] and kwargs.get('parameters', {}).get('media_type'):
|
||||||
# Grab formatted metadata
|
# Grab formatted metadata
|
||||||
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
||||||
|
media_type = pretty_metadata.media_type
|
||||||
poster_url = pretty_metadata.get_poster_url()
|
poster_url = pretty_metadata.get_poster_url()
|
||||||
provider = pretty_metadata.get_provider()
|
provider = pretty_metadata.get_provider()
|
||||||
provider_link = pretty_metadata.get_provider_link()
|
provider_link = pretty_metadata.get_provider_link()
|
||||||
title = pretty_metadata.get_title()
|
title = pretty_metadata.get_title()
|
||||||
subtitle = pretty_metadata.get_subtitle()
|
description = pretty_metadata.get_description()
|
||||||
plex_url = pretty_metadata.get_plex_url()
|
plex_url = pretty_metadata.get_plex_url()
|
||||||
|
|
||||||
card = {'title': title,
|
attachment = {'title': title,
|
||||||
'format': 'medium',
|
'format': 'medium',
|
||||||
'style': 'application',
|
'style': 'application',
|
||||||
'id': uuid.uuid4().hex,
|
'id': uuid.uuid4().hex,
|
||||||
'activity': {'html': text,
|
'activity': {'html': text,
|
||||||
'icon': {'url': poster_url}},
|
'icon': {'url': poster_url}},
|
||||||
'description': {'format': 'text',
|
'thumbnail': {'url': poster_url}
|
||||||
'value': subtitle},
|
}
|
||||||
'thumbnail': {'url': poster_url}
|
|
||||||
}
|
if self.config['incl_description'] or media_type in ('artist', 'album', 'track'):
|
||||||
|
attachment['description'] = {'format': 'text',
|
||||||
|
'value': description}
|
||||||
|
|
||||||
attributes = []
|
attributes = []
|
||||||
if provider_link:
|
if provider_link:
|
||||||
card['url'] = provider_link
|
attachment['url'] = provider_link
|
||||||
attributes.append({'label': 'View Details',
|
attributes.append({'label': 'View Details',
|
||||||
'value': {'label': provider,
|
'value': {'label': provider,
|
||||||
'url': provider_link}})
|
'url': provider_link}})
|
||||||
|
@ -1400,10 +1436,10 @@ class HIPCHAT(Notifier):
|
||||||
'value': {'label': 'Plex Web',
|
'value': {'label': 'Plex Web',
|
||||||
'url': plex_url}})
|
'url': plex_url}})
|
||||||
if attributes:
|
if attributes:
|
||||||
card['attributes'] = attributes
|
attachment['attributes'] = attributes
|
||||||
|
|
||||||
data['message'] = text
|
data['message'] = text
|
||||||
data['card'] = card
|
data['card'] = attachment
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if self.config['emoticon']:
|
if self.config['emoticon']:
|
||||||
|
@ -1462,22 +1498,29 @@ class HIPCHAT(Notifier):
|
||||||
' <a href="' + helpers.anon_url('https://www.hipchat.com/emoticons/') + '" target="_blank">here</a>.',
|
' <a href="' + helpers.anon_url('https://www.hipchat.com/emoticons/') + '" target="_blank">here</a>.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Include Poster',
|
{'label': 'Include Subject Line',
|
||||||
'value': self.config['incl_poster'],
|
'value': self.config['incl_subject'],
|
||||||
'name': 'hipchat_incl_poster',
|
'name': 'hipchat_incl_subject',
|
||||||
'description': 'Include a poster with the notifications.<br>Note: This will change the notification type to HTML and emoticons will no longer work.',
|
'description': 'Includes the subject with the notifications.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Rich Metadata Info',
|
||||||
|
'value': self.config['incl_card'],
|
||||||
|
'name': 'hipchat_incl_card',
|
||||||
|
'description': 'Include an info card with a poster and metadata with the notifications.<br>'
|
||||||
|
'Note: This will change the notification type to HTML and emoticons will no longer work.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Plot Summaries',
|
||||||
|
'value': self.config['incl_description'],
|
||||||
|
'name': 'hipchat_incl_description',
|
||||||
|
'description': 'Include a plot summary for movies and TV shows on the info card.',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
},
|
},
|
||||||
{'label': 'Include Link to Plex Web',
|
{'label': 'Include Link to Plex Web',
|
||||||
'value': self.config['incl_pmslink'],
|
'value': self.config['incl_pmslink'],
|
||||||
'name': 'hipchat_incl_pmslink',
|
'name': 'hipchat_incl_pmslink',
|
||||||
'description': 'Include a link to the media in Plex Web with the notifications.',
|
'description': 'Include a second link to the media in Plex Web on the info card.',
|
||||||
'input_type': 'checkbox'
|
|
||||||
},
|
|
||||||
{'label': 'Include Subject Line',
|
|
||||||
'value': self.config['incl_subject'],
|
|
||||||
'name': 'hipchat_incl_subject',
|
|
||||||
'description': 'Includes the subject with the notifications.',
|
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -2420,9 +2463,10 @@ class SLACK(Notifier):
|
||||||
'username': '',
|
'username': '',
|
||||||
'icon_emoji': '',
|
'icon_emoji': '',
|
||||||
'color': '',
|
'color': '',
|
||||||
'incl_pmslink': 0,
|
'incl_subject': 1,
|
||||||
'incl_poster': 0,
|
'incl_card': 0,
|
||||||
'incl_subject': 1
|
'incl_description': 1,
|
||||||
|
'incl_pmslink': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
def notify(self, subject='', body='', action='', **kwargs):
|
def notify(self, subject='', body='', action='', **kwargs):
|
||||||
|
@ -2445,20 +2489,20 @@ class SLACK(Notifier):
|
||||||
else:
|
else:
|
||||||
data['icon_url'] = self.config['icon_emoji']
|
data['icon_url'] = self.config['icon_emoji']
|
||||||
|
|
||||||
if self.config['incl_poster'] and kwargs.get('parameters', {}).get('media_type'):
|
if self.config['incl_card'] and kwargs.get('parameters', {}).get('media_type'):
|
||||||
# Grab formatted metadata
|
# Grab formatted metadata
|
||||||
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
pretty_metadata = PrettyMetadata(kwargs['parameters'])
|
||||||
|
media_type = pretty_metadata.media_type
|
||||||
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()
|
||||||
provider = pretty_metadata.get_provider()
|
provider = pretty_metadata.get_provider()
|
||||||
provider_link = pretty_metadata.get_provider_link()
|
provider_link = pretty_metadata.get_provider_link()
|
||||||
title = pretty_metadata.get_title()
|
title = pretty_metadata.get_title()
|
||||||
subtitle = pretty_metadata.get_subtitle()
|
description = pretty_metadata.get_description()
|
||||||
|
|
||||||
# Build Slack post attachment
|
# Build Slack post attachment
|
||||||
attachment = {'fallback': 'Image for %s' % title,
|
attachment = {'fallback': 'Image for %s' % title,
|
||||||
'title': title,
|
'title': title,
|
||||||
'text': subtitle,
|
|
||||||
'image_url': poster_url,
|
'image_url': poster_url,
|
||||||
'thumb_url': poster_url
|
'thumb_url': poster_url
|
||||||
}
|
}
|
||||||
|
@ -2466,6 +2510,9 @@ class SLACK(Notifier):
|
||||||
if self.config['color'] and self.config['color'].startswith('#'):
|
if self.config['color'] and self.config['color'].startswith('#'):
|
||||||
attachment['color'] = self.config['color']
|
attachment['color'] = self.config['color']
|
||||||
|
|
||||||
|
if self.config['incl_description'] or media_type in ('artist', 'album', 'track'):
|
||||||
|
attachment['text'] = description
|
||||||
|
|
||||||
fields = []
|
fields = []
|
||||||
if provider_link:
|
if provider_link:
|
||||||
attachment['title_link'] = provider_link
|
attachment['title_link'] = provider_link
|
||||||
|
@ -2516,41 +2563,47 @@ class SLACK(Notifier):
|
||||||
'description': 'The Slack channel name (begins with \'#\') which will be used. Leave blank for webhook integration default.',
|
'description': 'The Slack channel name (begins with \'#\') which will be used. Leave blank for webhook integration default.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Slack Username',
|
{'label': 'Slack Username',
|
||||||
'value': self.config['username'],
|
'value': self.config['username'],
|
||||||
'name': 'slack_username',
|
'name': 'slack_username',
|
||||||
'description': 'The Slack username which will be used. Leave blank for webhook integration default.',
|
'description': 'The Slack username which will be used. Leave blank for webhook integration default.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Slack Icon',
|
{'label': 'Slack Icon',
|
||||||
'value': self.config['icon_emoji'],
|
'value': self.config['icon_emoji'],
|
||||||
'description': 'The Slack emoji or image url for the icon which will be used. Leave blank for webhook integration default.',
|
'description': 'The Slack emoji or image url for the icon which will be used. Leave blank for webhook integration default.',
|
||||||
'name': 'slack_icon_emoji',
|
'name': 'slack_icon_emoji',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Slack Color',
|
{'label': 'Slack Color',
|
||||||
'value': self.config['color'],
|
'value': self.config['color'],
|
||||||
'description': 'The hex color value (begins with \'#\') for the border along the left side of the message attachment.',
|
'description': 'The hex color value (begins with \'#\') for the border along the left side of the message attachment.',
|
||||||
'name': 'slack_color',
|
'name': 'slack_color',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
|
||||||
{'label': 'Include Poster Image',
|
|
||||||
'value': self.config['incl_poster'],
|
|
||||||
'name': 'slack_incl_poster',
|
|
||||||
'description': 'Include a poster with the notifications.',
|
|
||||||
'input_type': 'checkbox'
|
|
||||||
},
|
|
||||||
{'label': 'Include Link to Plex Web',
|
|
||||||
'value': self.config['incl_pmslink'],
|
|
||||||
'name': 'slack_incl_pmslink',
|
|
||||||
'description': 'Include a second link to the media in Plex Web with the notifications.',
|
|
||||||
'input_type': 'checkbox'
|
|
||||||
},
|
},
|
||||||
{'label': 'Include Subject Line',
|
{'label': 'Include Subject Line',
|
||||||
'value': self.config['incl_subject'],
|
'value': self.config['incl_subject'],
|
||||||
'name': 'slack_incl_subject',
|
'name': 'slack_incl_subject',
|
||||||
'description': 'Include the subject line with the notifications.',
|
'description': 'Include the subject line with the notifications.',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Rich Metadata Info',
|
||||||
|
'value': self.config['incl_card'],
|
||||||
|
'name': 'slack_incl_card',
|
||||||
|
'description': 'Include an info card with a poster and metadata with the notifications.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Plot Summaries',
|
||||||
|
'value': self.config['incl_description'],
|
||||||
|
'name': 'slack_incl_description',
|
||||||
|
'description': 'Include a plot summary for movies and TV shows on the info card.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Link to Plex Web',
|
||||||
|
'value': self.config['incl_pmslink'],
|
||||||
|
'name': 'slack_incl_pmslink',
|
||||||
|
'description': 'Include a second link to the media in Plex Web on the info card.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2565,8 +2618,8 @@ class TELEGRAM(Notifier):
|
||||||
'chat_id': '',
|
'chat_id': '',
|
||||||
'disable_web_preview': 0,
|
'disable_web_preview': 0,
|
||||||
'html_support': 1,
|
'html_support': 1,
|
||||||
'incl_poster': 0,
|
'incl_subject': 1,
|
||||||
'incl_subject': 1
|
'incl_poster': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
def notify(self, subject='', body='', action='', **kwargs):
|
def notify(self, subject='', body='', action='', **kwargs):
|
||||||
|
@ -2646,18 +2699,18 @@ class TELEGRAM(Notifier):
|
||||||
' on Telegram to get an ID.',
|
' on Telegram to get an ID.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Include Poster Image',
|
|
||||||
'value': self.config['incl_poster'],
|
|
||||||
'name': 'telegram_incl_poster',
|
|
||||||
'description': 'Include a poster with the notifications.',
|
|
||||||
'input_type': 'checkbox'
|
|
||||||
},
|
|
||||||
{'label': 'Include Subject Line',
|
{'label': 'Include Subject Line',
|
||||||
'value': self.config['incl_subject'],
|
'value': self.config['incl_subject'],
|
||||||
'name': 'telegram_incl_subject',
|
'name': 'telegram_incl_subject',
|
||||||
'description': 'Include the subject line with the notifications.',
|
'description': 'Include the subject line with the notifications.',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
},
|
},
|
||||||
|
{'label': 'Include Poster Image',
|
||||||
|
'value': self.config['incl_poster'],
|
||||||
|
'name': 'telegram_incl_poster',
|
||||||
|
'description': 'Include a poster with the notifications.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
{'label': 'Enable HTML Support',
|
{'label': 'Enable HTML Support',
|
||||||
'value': self.config['html_support'],
|
'value': self.config['html_support'],
|
||||||
'name': 'telegram_html_support',
|
'name': 'telegram_html_support',
|
||||||
|
@ -2687,8 +2740,8 @@ class TWITTER(Notifier):
|
||||||
'access_token_secret': '',
|
'access_token_secret': '',
|
||||||
'consumer_key': '',
|
'consumer_key': '',
|
||||||
'consumer_secret': '',
|
'consumer_secret': '',
|
||||||
'incl_poster': 0,
|
'incl_subject': 1,
|
||||||
'incl_subject': 1
|
'incl_poster': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
def _send_tweet(self, message=None, attachment=None):
|
def _send_tweet(self, message=None, attachment=None):
|
||||||
|
@ -2757,17 +2810,17 @@ class TWITTER(Notifier):
|
||||||
'description': 'Your Twitter access token secret.',
|
'description': 'Your Twitter access token secret.',
|
||||||
'input_type': 'text'
|
'input_type': 'text'
|
||||||
},
|
},
|
||||||
{'label': 'Include Poster Image',
|
|
||||||
'value': self.config['incl_poster'],
|
|
||||||
'name': 'twitter_incl_poster',
|
|
||||||
'description': 'Include a poster with the notifications.',
|
|
||||||
'input_type': 'checkbox'
|
|
||||||
},
|
|
||||||
{'label': 'Include Subject Line',
|
{'label': 'Include Subject Line',
|
||||||
'value': self.config['incl_subject'],
|
'value': self.config['incl_subject'],
|
||||||
'name': 'twitter_incl_subject',
|
'name': 'twitter_incl_subject',
|
||||||
'description': 'Include the subject line with the notifications.',
|
'description': 'Include the subject line with the notifications.',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
|
},
|
||||||
|
{'label': 'Include Poster Image',
|
||||||
|
'value': self.config['incl_poster'],
|
||||||
|
'name': 'twitter_incl_poster',
|
||||||
|
'description': 'Include a poster with the notifications.',
|
||||||
|
'input_type': 'checkbox'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2903,11 +2956,14 @@ def upgrade_config_to_db():
|
||||||
# Config keys from the {new: old} config
|
# Config keys from the {new: old} config
|
||||||
config_key_overrides = {'plex': {'hosts': 'client_host'},
|
config_key_overrides = {'plex': {'hosts': 'client_host'},
|
||||||
'facebook': {'access_token': 'token',
|
'facebook': {'access_token': 'token',
|
||||||
'group_id': 'group'},
|
'group_id': 'group',
|
||||||
|
'incl_poster': 'incl_card'},
|
||||||
'join': {'device_id': 'deviceid'},
|
'join': {'device_id': 'deviceid'},
|
||||||
'hipchat': {'api_url': 'url'},
|
'hipchat': {'api_url': 'url',
|
||||||
|
'incl_poster': 'incl_card'},
|
||||||
'osx': {'notify_app': 'app'},
|
'osx': {'notify_app': 'app'},
|
||||||
'scripts': {'script_folder': 'folder'}
|
'scripts': {'script_folder': 'folder'},
|
||||||
|
'slack': {'incl_poster': 'incl_card'}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get Monitoring config section
|
# Get Monitoring config section
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue