From 76c15584733a27d6ad43868befcde9626c89d585 Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Tue, 13 Oct 2015 20:42:26 -0700 Subject: [PATCH 1/3] Add {remaining_duration} to notifications * Also clean up/reorder notification parameters --- data/interfaces/default/settings.html | 180 ++++++++++++++------------ plexpy/notification_handler.py | 16 ++- 2 files changed, 105 insertions(+), 91 deletions(-) diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 6e1db8b6..75873d0b 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -841,94 +841,106 @@ available_notification_agents = notifiers.available_notification_agents()

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + +
{user}The username of the person streaming.
{server_name}The name of your Plex Server.
{player}The name of the device being used for playback.
{platform}The type of client being used for playback.
{title}The title of the item being played back.
{show_name}The title of the TV series being played back.
{episode_name}The title of the episode being played back.
{album_name}The title of the album being played back if item is track.
{transcode_decision}The transcode decisions for the media item.
{year}The release year for the media item.
{studio}The studio for the media item.
{content_rating}The content rating for the media item. E.g. TV-MA, TV-PG, etc.
{summary}A short plot summary for the media item.
{season_num}The season number for the media item if item is episode.
{season_num00}The two digit season number.
{episode_num}The episode number for the media item if item is episode.
{episode_num00}The two digit episode number.
{rating}The rating (out of 10) for the item.
{duration}The duration (in minutes) for the item.
{server_name}The name of your Plex Server.
{user}The username of the person streaming.
{platform}The type of client being used for playback.
{player}The name of the device being used for playback.
{media_type}The type of media being played (movie, episode, track).
{title}The title of the item being played.
{show_name}The title of the TV series being played.
{episode_name}The title of the episode being played.
{artist_name}The name of the artist being played.
{album_name}The title of the album being played.
{season_num}The season number for the media item if item is episode.
{season_num00}The two digit season number.
{episode_num}The episode number for the media item if item is episode.
{episode_num00}The two digit episode number.
{transcode_decision}The transcode decisions for the media item.
{year}The release year for the media item.
{studio}The studio for the media item.
{content_rating}The content rating for the media item. (e.g. TV-MA, TV-PG, etc.)
{summary}A short plot summary for the media item.
{rating}The rating (out of 10) for the item.
{duration}The duration (in minutes) for the item.
{stream_duration} The stream duration (in minutes) for the item.
{progress}The last reported offset (in minutes) for the item.
{progress_percent}The last reported progress percent for the item.
{remaining_duration}The remaining duration (in minutes) for the item.
{progress}The last reported offset (in minutes) for the item.
{progress_percent}The last reported progress percent for the item.
diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 2f2637cc..dc9fce5b 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -320,25 +320,27 @@ def build_notify_text(session, state): available_params = {'server_name': server_name, 'user': session['friendly_name'], + 'platform': session['platform'], 'player': session['player'], + 'media_type': session['media_type'], 'title': full_title, 'show_name': item_metadata['grandparent_title'], 'episode_name': item_metadata['title'], - 'platform': session['platform'], - 'media_type': session['media_type'], + 'artist_name': item_metadata['grandparent_title'], + 'album_name': item_metadata['parent_title'], + 'season_num': item_metadata['parent_index'], + 'season_num00': item_metadata['parent_index'].zfill(2), + 'episode_num': item_metadata['index'], + 'episode_num00': item_metadata['index'].zfill(2), 'transcode_decision': transcode_decision, 'year': item_metadata['year'], 'studio': item_metadata['studio'], 'content_rating': item_metadata['content_rating'], 'summary': item_metadata['summary'], - 'season_num': item_metadata['parent_index'], - 'season_num00': item_metadata['parent_index'].zfill(2), - 'episode_num': item_metadata['index'], - 'episode_num00': item_metadata['index'].zfill(2), - 'album_name': item_metadata['parent_title'], 'rating': item_metadata['rating'], 'duration': duration, 'stream_duration': stream_duration, + 'remaining_duration': duration - view_offset, 'progress': view_offset, 'progress_percent': progress_percent } From 60b330573e98ba477d3c3206f51f4523fc73f106 Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Tue, 13 Oct 2015 20:59:24 -0700 Subject: [PATCH 2/3] Increase width of user watch time stats --- data/interfaces/default/css/plexpy.css | 4 ++-- data/interfaces/default/user_watch_time_stats.html | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/data/interfaces/default/css/plexpy.css b/data/interfaces/default/css/plexpy.css index 22e749c2..f5d89b6a 100644 --- a/data/interfaces/default/css/plexpy.css +++ b/data/interfaces/default/css/plexpy.css @@ -1518,7 +1518,7 @@ a:hover .item-children-poster { } .user-overview-stats-instance { float: left; - width: 350px; + width: 400px; height: 80px; margin-bottom: 25px; } @@ -1531,7 +1531,7 @@ a:hover .item-children-poster { .user-overview-stats-instance li { float: left; list-style: none; - width: 340px; + width: 100%; height: 90px; } .user-overview-stats-instance-text { diff --git a/data/interfaces/default/user_watch_time_stats.html b/data/interfaces/default/user_watch_time_stats.html index 17c626d2..fdaba5f6 100644 --- a/data/interfaces/default/user_watch_time_stats.html +++ b/data/interfaces/default/user_watch_time_stats.html @@ -32,13 +32,14 @@ DOCUMENTATION :: END

${a['total_plays']}

plays

/

- + + + - % endfor % else: From 3d1a1b5e45030ff33ead2872391d1b4b64bab754 Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Thu, 15 Oct 2015 18:02:28 -0700 Subject: [PATCH 3/3] Fix watch stats not showing on homepage --- data/interfaces/default/home_stats.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/interfaces/default/home_stats.html b/data/interfaces/default/home_stats.html index f65871f2..10832c41 100644 --- a/data/interfaces/default/home_stats.html +++ b/data/interfaces/default/home_stats.html @@ -65,7 +65,7 @@ DOCUMENTATION :: END %> % if data: -% if data[0]['rows']: +% if data[0]['stat_id']:
    % for top_stat in data: % if top_stat['stat_id'] == 'top_tv' and top_stat['rows']: