mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 13:23:24 -07:00
Merge pull request #1329 from samwiseg00/add/timezone_log
Determine system timezone, log the timezone, and display it in the web ui config table
This commit is contained in:
commit
f42581a5a6
3 changed files with 20 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'))
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import locale
|
||||
import pytz
|
||||
import signal
|
||||
import time
|
||||
import tzlocal
|
||||
|
||||
import plexpy
|
||||
from plexpy import config, database, logger, webstart
|
||||
|
@ -106,6 +109,14 @@ def main():
|
|||
logger.initLogger(console=not plexpy.QUIET, log_dir=False,
|
||||
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':
|
||||
plexpy.DOCKER = True
|
||||
|
||||
|
|
|
@ -71,6 +71,10 @@ DOCUMENTATION :: END
|
|||
<td>Platform:</td>
|
||||
<td>${common.PLATFORM} ${common.PLATFORM_RELEASE} (${common.PLATFORM_VERSION + (' - {}'.format(common.PLATFORM_LINUX_DISTRO) if common.PLATFORM_LINUX_DISTRO else '')})</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>System Timezone:</td>
|
||||
<td>${plexpy.SYS_TIMEZONE} (${'UTC{}'.format(plexpy.SYS_UTC_OFFSET)})
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Python Version:</td>
|
||||
<td>${sys.version}</td>
|
||||
|
|
|
@ -110,6 +110,8 @@ TRACKER = None
|
|||
|
||||
WIN_SYS_TRAY_ICON = None
|
||||
|
||||
SYS_TIMEZONE = None
|
||||
SYS_UTC_OFFSET = None
|
||||
|
||||
def initialize(config_file):
|
||||
with INIT_LOCK:
|
||||
|
@ -157,6 +159,9 @@ def initialize(config_file):
|
|||
common.PLATFORM, common.PLATFORM_RELEASE, common.PLATFORM_VERSION,
|
||||
' - {}'.format(common.PLATFORM_LINUX_DISTRO) if common.PLATFORM_LINUX_DISTRO else ''
|
||||
))
|
||||
logger.info(u"{} (UTC{})".format(
|
||||
plexpy.SYS_TIMEZONE, plexpy.SYS_UTC_OFFSET
|
||||
))
|
||||
logger.info(u"Python {}".format(
|
||||
sys.version
|
||||
))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue