diff --git a/Tautulli.py b/Tautulli.py index 24197109..d23c36df 100755 --- a/Tautulli.py +++ b/Tautulli.py @@ -110,12 +110,12 @@ def main(): 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') + plexpy.SYS_TIMEZONE = tzlocal.get_localzone() 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' + plexpy.SYS_TIMEZONE = pytz.UTC + + plexpy.SYS_UTC_OFFSET = datetime.datetime.now(plexpy.SYS_TIMEZONE).strftime('%z') if os.getenv('TAUTULLI_DOCKER', False) == 'True': plexpy.DOCKER = True diff --git a/data/interfaces/default/configuration_table.html b/data/interfaces/default/configuration_table.html index f7717d1a..0195978b 100644 --- a/data/interfaces/default/configuration_table.html +++ b/data/interfaces/default/configuration_table.html @@ -73,7 +73,7 @@ DOCUMENTATION :: END System Timezone: - ${plexpy.SYS_TIMEZONE} (${'UTC{}'.format(plexpy.SYS_UTC_OFFSET)}) + ${plexpy.SYS_TIMEZONE.zone} (${'UTC{}'.format(plexpy.SYS_UTC_OFFSET)}) Python Version: diff --git a/plexpy/__init__.py b/plexpy/__init__.py index d0c58165..f6e12d16 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -33,6 +33,7 @@ import cherrypy from apscheduler.schedulers.background import BackgroundScheduler from apscheduler.triggers.interval import IntervalTrigger from UniversalAnalytics import Tracker +import pytz import activity_handler import activity_pinger @@ -160,7 +161,7 @@ def initialize(config_file): ' - {}'.format(common.PLATFORM_LINUX_DISTRO) if common.PLATFORM_LINUX_DISTRO else '' )) logger.info(u"{} (UTC{})".format( - plexpy.SYS_TIMEZONE, plexpy.SYS_UTC_OFFSET + plexpy.SYS_TIMEZONE.zone, plexpy.SYS_UTC_OFFSET )) logger.info(u"Python {}".format( sys.version