Add {plex_url} as a notification option

This commit is contained in:
JonnyWong16 2016-05-03 00:49:22 -07:00
parent 65de742f96
commit 86aa21a8bb
2 changed files with 11 additions and 0 deletions

View file

@ -1812,6 +1812,10 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
<td><strong>{poster_url}</strong></td> <td><strong>{poster_url}</strong></td>
<td>A URL for the movie, TV show, or album poster.</td> <td>A URL for the movie, TV show, or album poster.</td>
</tr> </tr>
<tr>
<td><strong>{plex_url}</strong></td>
<td>The Plex URL to your server for the item.</td>
</tr>
<tr> <tr>
<td><strong>{imdb_id}</strong></td> <td><strong>{imdb_id}</strong></td>
<td>The IMDB ID for the movie. <span class="small-muted">(e.g. tt2488496)</span> <td>The IMDB ID for the movie. <span class="small-muted">(e.g. tt2488496)</span>

View file

@ -569,6 +569,12 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
progress_percent = helpers.get_percent(view_offset, duration) progress_percent = helpers.get_percent(view_offset, duration)
remaining_duration = duration - view_offset remaining_duration = duration - view_offset
# Build Plex URL
metadata['plex_url'] = ('http://app.plex.tv/web/app#!/server/'
+ plexpy.CONFIG.PMS_IDENTIFIER
+ '/details/%2Flibrary%2Fmetadata%2F'
+ rating_key)
# Get media IDs from guid and build URLs # Get media IDs from guid and build URLs
if 'imdb://' in metadata['guid']: if 'imdb://' in metadata['guid']:
metadata['imdb_id'] = metadata['guid'].split('imdb://')[1].split('?')[0] metadata['imdb_id'] = metadata['guid'].split('imdb://')[1].split('?')[0]
@ -725,6 +731,7 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
'rating': metadata['rating'], 'rating': metadata['rating'],
'duration': duration, 'duration': duration,
'poster_url': metadata.get('poster_url',''), 'poster_url': metadata.get('poster_url',''),
'plex_url': metadata.get('plex_url',''),
'imdb_id': metadata.get('imdb_id',''), 'imdb_id': metadata.get('imdb_id',''),
'imdb_url': metadata.get('imdb_url',''), 'imdb_url': metadata.get('imdb_url',''),
'thetvdb_id': metadata.get('thetvdb_id',''), 'thetvdb_id': metadata.get('thetvdb_id',''),