diff --git a/data/interfaces/default/scheduler_table.html b/data/interfaces/default/scheduler_table.html
index 37fd861c..dc66ebb7 100644
--- a/data/interfaces/default/scheduler_table.html
+++ b/data/interfaces/default/scheduler_table.html
@@ -10,9 +10,9 @@ DOCUMENTATION :: END
%doc>
<%!
- import arrow
+ import datetime
import plexpy
- from plexpy import common
+ from plexpy import common, helpers
scheduled_jobs = [j.id for j in plexpy.SCHED.get_jobs()]
%>
@@ -31,16 +31,15 @@ DOCUMENTATION :: END
% for job in common.SCHEDULER_LIST:
% if job in scheduled_jobs:
<%
- sched_job = plexpy.SCHED.get_job(job)
- run_interval = arrow.get(str(sched_job.trigger.interval), ['H:mm:ss', 'HH:mm:ss'])
- next_run_interval = arrow.get(sched_job.next_run_time).timestamp - arrow.now().timestamp
+ sched_job = plexpy.SCHED.get_job(job)
+ now = datetime.datetime.now(sched_job.next_run_time.tzinfo)
%>
${sched_job.id} |
Active |
- ${arrow.get(run_interval).format('HH:mm:ss')} |
- ${arrow.get(next_run_interval).format('HH:mm:ss')} |
- ${arrow.get(sched_job.next_run_time).format('YYYY-MM-DD HH:mm:ss')} |
+ ${helpers.format_timedelta_Hms(sched_job.trigger.interval)} |
+ ${helpers.format_timedelta_Hms(sched_job.next_run_time - now)} |
+ ${sched_job.next_run_time.strftime('%Y-%m-%d %H:%M:%S')} |
% elif job in ('Check for server response', 'Check for active sessions', 'Check for recently added items') and plexpy.WS_CONNECTED:
diff --git a/plexpy/helpers.py b/plexpy/helpers.py
index fbd7d205..2c6fc740 100644
--- a/plexpy/helpers.py
+++ b/plexpy/helpers.py
@@ -252,6 +252,14 @@ def human_duration(s, sig='dhms'):
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):
try: