Prio on launch browser
This commit is contained in:
@@ -37,7 +37,7 @@ config = [{
|
||||
},
|
||||
{
|
||||
'name': 'launch_browser',
|
||||
'default': 1,
|
||||
'default': True,
|
||||
'type': 'bool',
|
||||
'description': 'Launch the browser when I start.',
|
||||
'wizard': True,
|
||||
|
||||
@@ -26,7 +26,7 @@ class Core(Plugin):
|
||||
|
||||
addEvent('app.crappy_shutdown', self.shutdown)
|
||||
addEvent('app.crappy_restart', self.crappyRestart)
|
||||
addEvent('app.load', self.launchBrowser, priority = 100)
|
||||
addEvent('app.load', self.launchBrowser, priority = 1)
|
||||
addEvent('app.base_url', self.createBaseUrl)
|
||||
|
||||
addEvent('setting.save.core.password', self.md5Password)
|
||||
|
||||
@@ -13,7 +13,7 @@ def runHandler(name, handler, *args, **kwargs):
|
||||
except:
|
||||
log.error('Error in event "%s", that wasn\'nt caught: %s' % (name, traceback.format_exc()))
|
||||
|
||||
def addEvent(name, handler, priority = 0):
|
||||
def addEvent(name, handler, priority = 100):
|
||||
|
||||
if events.get(name):
|
||||
e = events[name]
|
||||
|
||||
+19
-6
@@ -1,14 +1,17 @@
|
||||
from argparse import ArgumentParser
|
||||
from couchpotato import web
|
||||
from couchpotato.api import api
|
||||
from couchpotato.core.event import fireEventAsync
|
||||
from couchpotato.core.event import fireEventAsync, fireEvent
|
||||
from couchpotato.core.helpers.variable import getDataDir, tryInt
|
||||
from daemon import createDaemon
|
||||
from logging import handlers
|
||||
from werkzeug.contrib.cache import FileSystemCache
|
||||
import logging
|
||||
import os.path
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
|
||||
def getOptions(base_path, args):
|
||||
|
||||
@@ -90,6 +93,7 @@ def runCouchPotato(options, base_path, args, handle = None):
|
||||
server_log.disabled = True
|
||||
|
||||
# Only run once when debugging
|
||||
fire_load = False
|
||||
if os.environ.get('WERKZEUG_RUN_MAIN') or not debug or options.binary_port:
|
||||
|
||||
# Logger
|
||||
@@ -146,10 +150,10 @@ def runCouchPotato(options, base_path, args, handle = None):
|
||||
from couchpotato.core.settings.model import setup
|
||||
setup()
|
||||
|
||||
fireEventAsync('app.load')
|
||||
|
||||
if initialize:
|
||||
fireEventAsync('app.initialize')
|
||||
fireEvent('app.initialize')
|
||||
|
||||
fire_load = True
|
||||
|
||||
# Create app
|
||||
from couchpotato import app
|
||||
@@ -174,7 +178,16 @@ def runCouchPotato(options, base_path, args, handle = None):
|
||||
app.register_blueprint(web, url_prefix = '%s/' % url_base)
|
||||
app.register_blueprint(api, url_prefix = '%s/%s/' % (url_base, api_key))
|
||||
|
||||
# Go go go!
|
||||
# Some logging and fire load event
|
||||
try: log.info('Starting server on port %(port)s' % config)
|
||||
except: pass
|
||||
app.run(**config)
|
||||
if fire_load: fireEventAsync('app.load')
|
||||
|
||||
# Go go go!
|
||||
try:
|
||||
app.run(**config)
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
raise
|
||||
except:
|
||||
log.error('Failed starting: %s' % traceback.format_exc())
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user