mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-22 14:13:40 -07:00
Added support for human-readable progress {progress_time} in notification messages
This commit is contained in:
parent
73ff28465d
commit
04677e51e0
3 changed files with 14 additions and 0 deletions
|
@ -1144,6 +1144,10 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
|||
<td><strong>{progress}</strong></td>
|
||||
<td>The last reported offset (in minutes) for the item.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{progress_time}</strong></td>
|
||||
<td>The last reported offset (in HH:MM:SS) for the item.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{progress_percent}</strong></td>
|
||||
<td>The last reported progress percent for the item.</td>
|
||||
|
|
|
@ -145,6 +145,14 @@ def today():
|
|||
def now():
|
||||
now = datetime.datetime.now()
|
||||
return now.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
def human_progress(ms):
|
||||
hp = ''
|
||||
if str(ms).isdigit():
|
||||
seconds = float(ms)/1000
|
||||
gmtime = time.gmtime(seconds)
|
||||
hp = time.strftime("%H:%M:%S", gmtime)
|
||||
return hp
|
||||
|
||||
def human_duration(s, sig='dhms'):
|
||||
|
||||
|
|
|
@ -484,6 +484,7 @@ def build_notify_text(session=None, timeline=None, state=None):
|
|||
stream_duration = int((time.time() - helpers.cast_to_float(session['started'])) / 60)
|
||||
|
||||
view_offset = helpers.convert_milliseconds_to_minutes(session['view_offset'])
|
||||
progress_time = helpers.human_progress(session['view_offset'])
|
||||
user = session['friendly_name']
|
||||
platform = session['platform']
|
||||
player = session['player']
|
||||
|
@ -535,6 +536,7 @@ def build_notify_text(session=None, timeline=None, state=None):
|
|||
'stream_duration': stream_duration,
|
||||
'remaining_duration': duration - view_offset,
|
||||
'progress': view_offset,
|
||||
'progress_time': progress_time,
|
||||
'progress_percent': progress_percent,
|
||||
'container': container,
|
||||
'video_codec': video_codec,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue