mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Fix scheduler table displaying intervals greater than 24 hours
This commit is contained in:
parent
81d443f34c
commit
ce4bfd56c2
2 changed files with 15 additions and 8 deletions
|
@ -10,9 +10,9 @@ DOCUMENTATION :: END
|
||||||
</%doc>
|
</%doc>
|
||||||
|
|
||||||
<%!
|
<%!
|
||||||
import arrow
|
import datetime
|
||||||
import plexpy
|
import plexpy
|
||||||
from plexpy import common
|
from plexpy import common, helpers
|
||||||
|
|
||||||
scheduled_jobs = [j.id for j in plexpy.SCHED.get_jobs()]
|
scheduled_jobs = [j.id for j in plexpy.SCHED.get_jobs()]
|
||||||
%>
|
%>
|
||||||
|
@ -31,16 +31,15 @@ DOCUMENTATION :: END
|
||||||
% for job in common.SCHEDULER_LIST:
|
% for job in common.SCHEDULER_LIST:
|
||||||
% if job in scheduled_jobs:
|
% if job in scheduled_jobs:
|
||||||
<%
|
<%
|
||||||
sched_job = plexpy.SCHED.get_job(job)
|
sched_job = plexpy.SCHED.get_job(job)
|
||||||
run_interval = arrow.get(str(sched_job.trigger.interval), ['H:mm:ss', 'HH:mm:ss'])
|
now = datetime.datetime.now(sched_job.next_run_time.tzinfo)
|
||||||
next_run_interval = arrow.get(sched_job.next_run_time).timestamp - arrow.now().timestamp
|
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td>${sched_job.id}</td>
|
<td>${sched_job.id}</td>
|
||||||
<td><i class="fa fa-sm fa-fw fa-check"></i> Active</td>
|
<td><i class="fa fa-sm fa-fw fa-check"></i> Active</td>
|
||||||
<td>${arrow.get(run_interval).format('HH:mm:ss')}</td>
|
<td>${helpers.format_timedelta_Hms(sched_job.trigger.interval)}</td>
|
||||||
<td>${arrow.get(next_run_interval).format('HH:mm:ss')}</td>
|
<td>${helpers.format_timedelta_Hms(sched_job.next_run_time - now)}</td>
|
||||||
<td>${arrow.get(sched_job.next_run_time).format('YYYY-MM-DD HH:mm:ss')}</td>
|
<td>${sched_job.next_run_time.strftime('%Y-%m-%d %H:%M:%S')}</td>
|
||||||
</tr>
|
</tr>
|
||||||
% elif job in ('Check for server response', 'Check for active sessions', 'Check for recently added items') and plexpy.WS_CONNECTED:
|
% elif job in ('Check for server response', 'Check for active sessions', 'Check for recently added items') and plexpy.WS_CONNECTED:
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -252,6 +252,14 @@ def human_duration(s, sig='dhms'):
|
||||||
return hd
|
return hd
|
||||||
|
|
||||||
|
|
||||||
|
def format_timedelta_Hms(td):
|
||||||
|
s = td.total_seconds()
|
||||||
|
hours = s // 3600
|
||||||
|
minutes = (s % 3600) // 60
|
||||||
|
seconds = s % 60
|
||||||
|
return '{:02d}:{:02d}:{:02d}'.format(int(hours), int(minutes), int(seconds))
|
||||||
|
|
||||||
|
|
||||||
def get_age(date):
|
def get_age(date):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue