Prio on launch browser
This commit is contained in:
1 parent
6bf6ffd4f8
commit
33a8eb9fb1
4 files changed
+22
-9
No files matched your search
@@ -37,7 +37,7 @@ config = [{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'launch_browser',
|
'name': 'launch_browser',
|
||||||
'default': 1,
|
'default': True,
|
||||||
'type': 'bool',
|
'type': 'bool',
|
||||||
'description': 'Launch the browser when I start.',
|
'description': 'Launch the browser when I start.',
|
||||||
'wizard': True,
|
'wizard': True,
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class Core(Plugin):
|
|||||||
|
|
||||||
addEvent('app.crappy_shutdown', self.shutdown)
|
addEvent('app.crappy_shutdown', self.shutdown)
|
||||||
addEvent('app.crappy_restart', self.crappyRestart)
|
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('app.base_url', self.createBaseUrl)
|
||||||
|
|
||||||
addEvent('setting.save.core.password', self.md5Password)
|
addEvent('setting.save.core.password', self.md5Password)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ def runHandler(name, handler, *args, **kwargs):
|
|||||||
except:
|
except:
|
||||||
log.error('Error in event "%s", that wasn\'nt caught: %s' % (name, traceback.format_exc()))
|
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):
|
if events.get(name):
|
||||||
e = events[name]
|
e = events[name]
|
||||||
|
|||||||
+19
-6
@@ -1,14 +1,17 @@
|
|||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from couchpotato import web
|
from couchpotato import web
|
||||||
from couchpotato.api import api
|
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 couchpotato.core.helpers.variable import getDataDir, tryInt
|
||||||
from daemon import createDaemon
|
from daemon import createDaemon
|
||||||
from logging import handlers
|
from logging import handlers
|
||||||
from werkzeug.contrib.cache import FileSystemCache
|
from werkzeug.contrib.cache import FileSystemCache
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
|
import socket
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
|
||||||
def getOptions(base_path, args):
|
def getOptions(base_path, args):
|
||||||
|
|
||||||
@@ -90,6 +93,7 @@ def runCouchPotato(options, base_path, args, handle = None):
|
|||||||
server_log.disabled = True
|
server_log.disabled = True
|
||||||
|
|
||||||
# Only run once when debugging
|
# Only run once when debugging
|
||||||
|
fire_load = False
|
||||||
if os.environ.get('WERKZEUG_RUN_MAIN') or not debug or options.binary_port:
|
if os.environ.get('WERKZEUG_RUN_MAIN') or not debug or options.binary_port:
|
||||||
|
|
||||||
# Logger
|
# Logger
|
||||||
@@ -146,10 +150,10 @@ def runCouchPotato(options, base_path, args, handle = None):
|
|||||||
from couchpotato.core.settings.model import setup
|
from couchpotato.core.settings.model import setup
|
||||||
setup()
|
setup()
|
||||||
|
|
||||||
fireEventAsync('app.load')
|
|
||||||
|
|
||||||
if initialize:
|
if initialize:
|
||||||
fireEventAsync('app.initialize')
|
fireEvent('app.initialize')
|
||||||
|
|
||||||
|
fire_load = True
|
||||||
|
|
||||||
# Create app
|
# Create app
|
||||||
from couchpotato import 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(web, url_prefix = '%s/' % url_base)
|
||||||
app.register_blueprint(api, url_prefix = '%s/%s/' % (url_base, api_key))
|
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)
|
try: log.info('Starting server on port %(port)s' % config)
|
||||||
except: pass
|
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