Adds stream_duration to notification options

This commit is contained in:
Jonathan Wong 2015-08-21 02:59:49 -07:00
parent b2a7f639bb
commit cba8608c23

View file

@ -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 # PlexPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # 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']) duration = helpers.convert_milliseconds_to_minutes(item_metadata['duration'])
view_offset = helpers.convert_milliseconds_to_minutes(session['view_offset']) 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) progress_percent = helpers.get_percent(view_offset, duration)
@ -323,6 +324,7 @@ def build_notify_text(session, state):
'album_name': item_metadata['parent_title'], 'album_name': item_metadata['parent_title'],
'rating': item_metadata['rating'], 'rating': item_metadata['rating'],
'duration': duration, 'duration': duration,
'stream_duration': stream_duration,
'progress': view_offset, 'progress': view_offset,
'progress_percent': progress_percent 'progress_percent': progress_percent
} }