From f1d44c051dfa5f6219551dc4ffae04be7952fb31 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Thu, 6 Jun 2024 21:39:33 -0700 Subject: [PATCH] Fix loading of scheduled tasks when tasks are disabled --- data/interfaces/default/scheduler_table.html | 7 ++----- plexpy/common.py | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/data/interfaces/default/scheduler_table.html b/data/interfaces/default/scheduler_table.html index 8d264aa9..c4087f17 100644 --- a/data/interfaces/default/scheduler_table.html +++ b/data/interfaces/default/scheduler_table.html @@ -13,8 +13,6 @@ DOCUMENTATION :: END import datetime import plexpy from plexpy import common, helpers - - scheduled_jobs = [j.id for j in plexpy.SCHED.get_jobs()] %> @@ -29,16 +27,15 @@ DOCUMENTATION :: END % for job, job_type in common.SCHEDULER_LIST.items(): - % if job in scheduled_jobs: <% sched_job = plexpy.SCHED.get_job(job) - now = datetime.datetime.now(sched_job.next_run_time.tzinfo) %> + % if sched_job: - + % elif job_type == 'websocket' and plexpy.WS_CONNECTED: diff --git a/plexpy/common.py b/plexpy/common.py index ae6f6c98..fb35beb3 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -237,7 +237,7 @@ EXTRA_TYPES = { } SCHEDULER_LIST = [ - ('Check GitHub for updates', 'websocket'), + ('Check GitHub for updates', 'scheduled'), ('Check for server response', 'websocket'), ('Check for active sessions', 'websocket'), ('Check for recently added items', 'websocket'),
${sched_job.id} Active ${helpers.format_timedelta_Hms(sched_job.trigger.interval)}${helpers.format_timedelta_Hms(sched_job.next_run_time - now)}${helpers.format_timedelta_Hms(sched_job.next_run_time - datetime.datetime.now(sched_job.next_run_time.tzinfo))} ${sched_job.next_run_time.astimezone(plexpy.SYS_TIMEZONE).strftime('%Y-%m-%d %H:%M:%S')}