Add startup error alert message

This commit is contained in:
JonnyWong16 2021-08-27 14:17:16 -07:00
parent 0fbb28eca2
commit 09eba5d8b5
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 13 additions and 0 deletions

View file

@ -15,7 +15,9 @@
from __future__ import unicode_literals
from future.builtins import range
from future.builtins import str
import ctypes
import datetime
import os
import future.moves.queue as queue
@ -169,6 +171,7 @@ def initialize(config_file):
try:
CONFIG = config.Config(config_file)
except:
alert_message('Failed to start Tautulli: Config file is corrupted.\n\n%s' % config_file)
raise SystemExit("Unable to initialize Tautulli due to a corrupted config file. Exiting...")
CONFIG_FILE = config_file
@ -2738,3 +2741,12 @@ def get_tautulli_info():
'tautulli_python_version': common.PYTHON_VERSION,
}
return tautulli
def alert_message(msg, title='Tautulli Startup Error'):
if common.PLATFORM == 'Windows':
ctypes.windll.user32.MessageBoxW(0, str(msg), str(title), 0)
elif common.PLATFORM == 'Darwin':
applescript = 'display dialog "%s" with title "%s"' \
'with icon caution buttons {"OK"}' % (msg, title)
os.system("osascript -e '%s'" % applescript)

View file

@ -265,6 +265,7 @@ def initialize(options):
cherrypy.engine.block()
except IOError as e:
logger.error("Tautulli WebStart :: Failed to start Tautulli: %s", e)
plexpy.alert_message('Failed to start Tautulli: %s' % e)
sys.exit(1)
cherrypy.server.wait()