More options for desktop
This commit is contained in:
1 parent
8334f5e899
commit
c670a951cb
2 files changed
+19
-4
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
|
from couchpotato.core.event import fireEvent, addEvent
|
||||||
from couchpotato.core.loader import Loader
|
from couchpotato.core.loader import Loader
|
||||||
from couchpotato.core.settings import Settings
|
from couchpotato.core.settings import Settings
|
||||||
|
|
||||||
@@ -52,3 +53,11 @@ class Env(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def getPermission(type):
|
def getPermission(type):
|
||||||
return int(Env.get('settings').get('permission_%s' % type, default = 0777))
|
return int(Env.get('settings').get('permission_%s' % type, default = 0777))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def fireEvent(*args, **kwargs):
|
||||||
|
return fireEvent(*args, **kwargs)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def addEvent(*args, **kwargs):
|
||||||
|
return addEvent(*args, **kwargs)
|
||||||
+10
-4
@@ -26,8 +26,10 @@ def getOptions(base_path, args):
|
|||||||
dest = 'daemonize', help = 'Daemonize the app')
|
dest = 'daemonize', help = 'Daemonize the app')
|
||||||
parser.add_argument('--quiet', action = 'store_true',
|
parser.add_argument('--quiet', action = 'store_true',
|
||||||
dest = 'quiet', help = 'No console logging')
|
dest = 'quiet', help = 'No console logging')
|
||||||
|
parser.add_argument('--binary', action = 'store_true',
|
||||||
|
dest = 'binary', help = 'Running from binary build')
|
||||||
parser.add_argument('--nogit', action = 'store_true',
|
parser.add_argument('--nogit', action = 'store_true',
|
||||||
dest = 'nogit', help = 'Running from git')
|
dest = 'nogit', help = 'No git available')
|
||||||
|
|
||||||
options = parser.parse_args(args)
|
options = parser.parse_args(args)
|
||||||
|
|
||||||
@@ -36,13 +38,16 @@ def getOptions(base_path, args):
|
|||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
def runCouchPotato(options, base_path, args):
|
def runCouchPotato(options, base_path, args, handle = None):
|
||||||
|
|
||||||
# Load settings
|
# Load settings
|
||||||
from couchpotato.environment import Env
|
from couchpotato.environment import Env
|
||||||
settings = Env.get('settings')
|
settings = Env.get('settings')
|
||||||
settings.setFile(options.config_file)
|
settings.setFile(options.config_file)
|
||||||
|
|
||||||
|
if handle:
|
||||||
|
handle(Env)
|
||||||
|
|
||||||
# Create data dir if needed
|
# Create data dir if needed
|
||||||
data_dir = os.path.expanduser(Env.setting('data_dir'))
|
data_dir = os.path.expanduser(Env.setting('data_dir'))
|
||||||
if data_dir == '':
|
if data_dir == '':
|
||||||
@@ -72,6 +77,7 @@ def runCouchPotato(options, base_path, args):
|
|||||||
Env.set('console_log', options.console_log)
|
Env.set('console_log', options.console_log)
|
||||||
Env.set('daemonize', options.daemonize)
|
Env.set('daemonize', options.daemonize)
|
||||||
Env.set('quiet', options.quiet)
|
Env.set('quiet', options.quiet)
|
||||||
|
Env.set('binary', options.binary)
|
||||||
Env.set('args', args)
|
Env.set('args', args)
|
||||||
Env.set('options', options)
|
Env.set('options', options)
|
||||||
|
|
||||||
@@ -84,7 +90,7 @@ def runCouchPotato(options, base_path, args):
|
|||||||
server_log.disabled = True
|
server_log.disabled = True
|
||||||
|
|
||||||
# Only run once when debugging
|
# Only run once when debugging
|
||||||
if os.environ.get('WERKZEUG_RUN_MAIN') or not debug:
|
if os.environ.get('WERKZEUG_RUN_MAIN') or not debug or options.binary:
|
||||||
|
|
||||||
# Logger
|
# Logger
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
@@ -149,7 +155,7 @@ def runCouchPotato(options, base_path, args):
|
|||||||
from couchpotato import app
|
from couchpotato import app
|
||||||
api_key = Env.setting('api_key')
|
api_key = Env.setting('api_key')
|
||||||
url_base = '/' + Env.setting('url_base').lstrip('/') if Env.setting('url_base') else ''
|
url_base = '/' + Env.setting('url_base').lstrip('/') if Env.setting('url_base') else ''
|
||||||
reloader = debug is True and not options.daemonize
|
reloader = debug is True and not options.daemonize and not options.binary
|
||||||
|
|
||||||
# Basic config
|
# Basic config
|
||||||
app.secret_key = api_key
|
app.secret_key = api_key
|
||||||
|
|||||||
Reference in new issue
Block a user