mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 07:22:37 -07:00
Add summary to Facebook posts
This commit is contained in:
parent
1d01d0bff1
commit
b743cca7bc
2 changed files with 24 additions and 21 deletions
|
@ -552,7 +552,8 @@ def uploadToImgur(imgPath, imgTitle=''):
|
||||||
response = json.loads(response.read())
|
response = json.loads(response.read())
|
||||||
|
|
||||||
if response.get('status') == 200:
|
if response.get('status') == 200:
|
||||||
logger.debug(u"PlexPy Helpers :: Image uploaded to Imgur.")
|
t = '\'' + imgTitle + '\' ' if imgTitle else ''
|
||||||
|
logger.debug(u"PlexPy Helpers :: Image %suploaded to Imgur." % t)
|
||||||
img_url = response.get('data').get('link', '')
|
img_url = response.get('data').get('link', '')
|
||||||
elif response.get('status') >= 400 and response.get('status') < 500:
|
elif response.get('status') >= 400 and response.get('status') < 500:
|
||||||
logger.warn(u"PlexPy Helpers :: Unable to upload image to Imgur: %s" % response.reason)
|
logger.warn(u"PlexPy Helpers :: Unable to upload image to Imgur: %s" % response.reason)
|
||||||
|
|
|
@ -2169,50 +2169,53 @@ class FacebookNotifier(object):
|
||||||
if self.incl_poster and 'metadata' in kwargs:
|
if self.incl_poster and 'metadata' in kwargs:
|
||||||
metadata = kwargs['metadata']
|
metadata = kwargs['metadata']
|
||||||
poster_url = metadata.get('poster_url','')
|
poster_url = metadata.get('poster_url','')
|
||||||
|
caption = ''
|
||||||
|
|
||||||
if poster_url:
|
if poster_url:
|
||||||
if metadata['media_type'] == 'movie':
|
if metadata['media_type'] == 'movie':
|
||||||
title = metadata['title']
|
title = '%s (%s)' % (metadata['title'], metadata['year'])
|
||||||
subtitle = metadata['year']
|
subtitle = metadata['summary']
|
||||||
rating_key = metadata['rating_key']
|
rating_key = metadata['rating_key']
|
||||||
if metadata.get('imdb_url',''):
|
if metadata.get('imdb_url',''):
|
||||||
poster_link = metadata.get('imdb_url', '')
|
poster_link = metadata.get('imdb_url', '')
|
||||||
caption = 'View on IMDB.'
|
caption = 'View on IMDB'
|
||||||
elif metadata.get('themoviedb_url',''):
|
elif metadata.get('themoviedb_url',''):
|
||||||
poster_link = metadata.get('themoviedb_url', '')
|
poster_link = metadata.get('themoviedb_url', '')
|
||||||
caption = 'View on The Movie Database.'
|
caption = 'View on The Movie Database'
|
||||||
|
|
||||||
elif metadata['media_type'] == 'show':
|
elif metadata['media_type'] == 'show':
|
||||||
title = metadata['title']
|
title = '%s (%s)' % (metadata['title'], metadata['year'])
|
||||||
subtitle = metadata['year']
|
subtitle = metadata['summary']
|
||||||
rating_key = metadata['rating_key']
|
rating_key = metadata['rating_key']
|
||||||
if metadata.get('thetvdb_url',''):
|
if metadata.get('thetvdb_url',''):
|
||||||
poster_link = metadata.get('thetvdb_url', '')
|
poster_link = metadata.get('thetvdb_url', '')
|
||||||
caption = 'View on TheTVDB.'
|
caption = 'View on TheTVDB'
|
||||||
elif metadata.get('themoviedb_url',''):
|
elif metadata.get('themoviedb_url',''):
|
||||||
poster_link = metadata.get('themoviedb_url', '')
|
poster_link = metadata.get('themoviedb_url', '')
|
||||||
caption = 'View on The Movie Database.'
|
caption = 'View on The Movie Database'
|
||||||
|
|
||||||
elif metadata['media_type'] == 'episode':
|
elif metadata['media_type'] == 'episode':
|
||||||
title = '%s - %s' % (metadata['grandparent_title'], metadata['title'])
|
title = '%s - %s (S%s %s E%s)' % (metadata['grandparent_title'],
|
||||||
subtitle = 'S%s %s E%s' % (metadata['parent_media_index'],
|
metadata['title'],
|
||||||
'\xc2\xb7'.decode('utf8'),
|
metadata['parent_media_index'],
|
||||||
metadata['media_index'])
|
'\xc2\xb7'.decode('utf8'),
|
||||||
|
metadata['media_index'])
|
||||||
|
subtitle = metadata['summary']
|
||||||
rating_key = metadata['rating_key']
|
rating_key = metadata['rating_key']
|
||||||
if metadata.get('thetvdb_url',''):
|
if metadata.get('thetvdb_url',''):
|
||||||
poster_link = metadata.get('thetvdb_url', '')
|
poster_link = metadata.get('thetvdb_url', '')
|
||||||
caption = 'View on TheTVDB.'
|
caption = 'View on TheTVDB'
|
||||||
elif metadata.get('themoviedb_url',''):
|
elif metadata.get('themoviedb_url',''):
|
||||||
poster_link = metadata.get('themoviedb_url', '')
|
poster_link = metadata.get('themoviedb_url', '')
|
||||||
caption = 'View on The Movie Database.'
|
caption = 'View on The Movie Database'
|
||||||
|
|
||||||
elif metadata['media_type'] == 'artist':
|
elif metadata['media_type'] == 'artist':
|
||||||
title = metadata['title']
|
title = metadata['title']
|
||||||
subtitle = ''
|
subtitle = metadata['summary']
|
||||||
rating_key = metadata['rating_key']
|
rating_key = metadata['rating_key']
|
||||||
if metadata.get('lastfm_url',''):
|
if metadata.get('lastfm_url',''):
|
||||||
poster_link = metadata.get('lastfm_url', '')
|
poster_link = metadata.get('lastfm_url', '')
|
||||||
caption = 'View on Last.fm.'
|
caption = 'View on Last.fm'
|
||||||
|
|
||||||
elif metadata['media_type'] == 'track':
|
elif metadata['media_type'] == 'track':
|
||||||
title = '%s - %s' % (metadata['grandparent_title'], metadata['title'])
|
title = '%s - %s' % (metadata['grandparent_title'], metadata['title'])
|
||||||
|
@ -2220,23 +2223,22 @@ class FacebookNotifier(object):
|
||||||
rating_key = metadata['parent_rating_key']
|
rating_key = metadata['parent_rating_key']
|
||||||
if metadata.get('lastfm_url',''):
|
if metadata.get('lastfm_url',''):
|
||||||
poster_link = metadata.get('lastfm_url', '')
|
poster_link = metadata.get('lastfm_url', '')
|
||||||
caption = 'View on Last.fm.'
|
caption = 'View on Last.fm'
|
||||||
|
|
||||||
# Build Facebook post attachment
|
# Build Facebook post attachment
|
||||||
if self.incl_pmslink:
|
if self.incl_pmslink:
|
||||||
caption = 'View on Plex Web.'
|
caption = 'View on Plex Web'
|
||||||
attachment['link'] = 'http://app.plex.tv/web/app#!/server/' + plexpy.CONFIG.PMS_IDENTIFIER + \
|
attachment['link'] = 'http://app.plex.tv/web/app#!/server/' + plexpy.CONFIG.PMS_IDENTIFIER + \
|
||||||
'/details/%2Flibrary%2Fmetadata%2F' + rating_key
|
'/details/%2Flibrary%2Fmetadata%2F' + rating_key
|
||||||
attachment['caption'] = caption
|
|
||||||
elif poster_link:
|
elif poster_link:
|
||||||
attachment['link'] = poster_link
|
attachment['link'] = poster_link
|
||||||
attachment['caption'] = caption
|
|
||||||
else:
|
else:
|
||||||
attachment['link'] = poster_url
|
attachment['link'] = poster_url
|
||||||
|
|
||||||
attachment['picture'] = poster_url
|
attachment['picture'] = poster_url
|
||||||
attachment['name'] = title
|
attachment['name'] = title
|
||||||
attachment['description'] = subtitle
|
attachment['description'] = subtitle
|
||||||
|
attachment['caption'] = caption
|
||||||
|
|
||||||
try:
|
try:
|
||||||
api.put_wall_post(profile_id=self.group_id, message=message, attachment=attachment)
|
api.put_wall_post(profile_id=self.group_id, message=message, attachment=attachment)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue