mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Add logic to determine system timezone
This commit is contained in:
parent
d731ad851c
commit
c64a115d29
1 changed files with 11 additions and 0 deletions
11
Tautulli.py
11
Tautulli.py
|
@ -28,9 +28,12 @@ import sys
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib'))
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import datetime
|
||||||
import locale
|
import locale
|
||||||
|
import pytz
|
||||||
import signal
|
import signal
|
||||||
import time
|
import time
|
||||||
|
import tzlocal
|
||||||
|
|
||||||
import plexpy
|
import plexpy
|
||||||
from plexpy import config, database, logger, webstart
|
from plexpy import config, database, logger, webstart
|
||||||
|
@ -106,6 +109,14 @@ def main():
|
||||||
logger.initLogger(console=not plexpy.QUIET, log_dir=False,
|
logger.initLogger(console=not plexpy.QUIET, log_dir=False,
|
||||||
verbose=plexpy.VERBOSE)
|
verbose=plexpy.VERBOSE)
|
||||||
|
|
||||||
|
try:
|
||||||
|
plexpy.SYS_TIMEZONE = str(tzlocal.get_localzone())
|
||||||
|
plexpy.SYS_UTC_OFFSET = datetime.datetime.now(pytz.timezone(plexpy.SYS_TIMEZONE)).strftime('%z')
|
||||||
|
except (pytz.UnknownTimeZoneError, LookupError, ValueError) as e:
|
||||||
|
logger.error("Could not determine system timezone. %s" % e)
|
||||||
|
plexpy.SYS_TIMEZONE = 'Unknown'
|
||||||
|
plexpy.SYS_UTC_OFFSET = '+0000'
|
||||||
|
|
||||||
if os.getenv('TAUTULLI_DOCKER', False) == 'True':
|
if os.getenv('TAUTULLI_DOCKER', False) == 'True':
|
||||||
plexpy.DOCKER = True
|
plexpy.DOCKER = True
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue