From e78857072669c94b42e6e2be662d6dd54429a951 Mon Sep 17 00:00:00 2001 From: morpheus65535 <5130500+morpheus65535@users.noreply.github.com> Date: Fri, 9 Mar 2018 23:17:51 -0500 Subject: [PATCH] Fallback to UTC if no timezone information is available #49 --- requirements.txt | 1 + scheduler.py | 7 ++++++- update_modules.py | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 58f3a6037..0f4f2be37 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,5 +12,6 @@ py-pretty pycountry requests subliminal +tzlocal urllib3 waitress \ No newline at end of file diff --git a/scheduler.py b/scheduler.py index cbd730d8c..57ceeb07f 100644 --- a/scheduler.py +++ b/scheduler.py @@ -7,8 +7,13 @@ from check_update import * from apscheduler.schedulers.background import BackgroundScheduler from datetime import datetime +from tzlocal import get_localzone + +if str(get_localzone()) == "local": + scheduler = BackgroundScheduler(timezone=utc) +else: + scheduler = BackgroundScheduler() -scheduler = BackgroundScheduler() if automatic == 'True': scheduler.add_job(check_and_apply_update, 'interval', hours=6, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_bazarr', name='Update bazarr from source on Github') else: diff --git a/update_modules.py b/update_modules.py index 570ec7d4f..ed25717a5 100644 --- a/update_modules.py +++ b/update_modules.py @@ -12,5 +12,10 @@ except SystemExit as e: try: pip.main(['install', '--user', 'apprise']) +except SystemExit as e: + pass + +try: + pip.main(['install', '--user', 'tzlocal']) except SystemExit as e: pass \ No newline at end of file