From 86aa21a8bb4ba06feb4584b23cc4f0a80e2bcb4e Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 3 May 2016 00:49:22 -0700 Subject: [PATCH] Add {plex_url} as a notification option --- data/interfaces/default/settings.html | 4 ++++ plexpy/notification_handler.py | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 59d4d18c..f4f6fde5 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -1812,6 +1812,10 @@ available_notification_agents = sorted(notifiers.available_notification_agents() {poster_url} A URL for the movie, TV show, or album poster. + + {plex_url} + The Plex URL to your server for the item. + {imdb_id} The IMDB ID for the movie. (e.g. tt2488496) diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 49c48b12..1b27dd3e 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -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) 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 if 'imdb://' in metadata['guid']: 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'], 'duration': duration, 'poster_url': metadata.get('poster_url',''), + 'plex_url': metadata.get('plex_url',''), 'imdb_id': metadata.get('imdb_id',''), 'imdb_url': metadata.get('imdb_url',''), 'thetvdb_id': metadata.get('thetvdb_id',''),