diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index de7cdeb5..dcc8e164 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -842,6 +842,10 @@ available_notification_agents = notifiers.available_notification_agents() {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. diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index c9563d84..0429bb30 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -1,4 +1,4 @@ -# This file is part of PlexPy. +# This file is part of PlexPy. # # PlexPy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -300,6 +300,7 @@ def build_notify_text(session, state): duration = helpers.convert_milliseconds_to_minutes(item_metadata['duration']) view_offset = helpers.convert_milliseconds_to_minutes(session['view_offset']) + stream_duration = 0 if state == 'play' else int((time.time() - helpers.cast_to_float(session['started']) - helpers.cast_to_float(session['paused_counter'])) / 60) progress_percent = helpers.get_percent(view_offset, duration) @@ -323,6 +324,7 @@ def build_notify_text(session, state): 'album_name': item_metadata['parent_title'], 'rating': item_metadata['rating'], 'duration': duration, + 'stream_duration': stream_duration, 'progress': view_offset, 'progress_percent': progress_percent }