mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 15:32:38 -07:00
Add startup error alert message
This commit is contained in:
parent
0fbb28eca2
commit
09eba5d8b5
2 changed files with 13 additions and 0 deletions
|
@ -15,7 +15,9 @@
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from future.builtins import range
|
from future.builtins import range
|
||||||
|
from future.builtins import str
|
||||||
|
|
||||||
|
import ctypes
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
import future.moves.queue as queue
|
import future.moves.queue as queue
|
||||||
|
@ -169,6 +171,7 @@ def initialize(config_file):
|
||||||
try:
|
try:
|
||||||
CONFIG = config.Config(config_file)
|
CONFIG = config.Config(config_file)
|
||||||
except:
|
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...")
|
raise SystemExit("Unable to initialize Tautulli due to a corrupted config file. Exiting...")
|
||||||
|
|
||||||
CONFIG_FILE = config_file
|
CONFIG_FILE = config_file
|
||||||
|
@ -2738,3 +2741,12 @@ def get_tautulli_info():
|
||||||
'tautulli_python_version': common.PYTHON_VERSION,
|
'tautulli_python_version': common.PYTHON_VERSION,
|
||||||
}
|
}
|
||||||
return tautulli
|
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)
|
||||||
|
|
|
@ -265,6 +265,7 @@ def initialize(options):
|
||||||
cherrypy.engine.block()
|
cherrypy.engine.block()
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logger.error("Tautulli WebStart :: Failed to start Tautulli: %s", e)
|
logger.error("Tautulli WebStart :: Failed to start Tautulli: %s", e)
|
||||||
|
plexpy.alert_message('Failed to start Tautulli: %s' % e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
cherrypy.server.wait()
|
cherrypy.server.wait()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue