|
|
@ -25,8 +25,6 @@ def getOptions(base_path, args): |
|
|
|
dest = 'console_log', help = "Log to console") |
|
|
|
parser.add_argument('--quiet', action = 'store_true', |
|
|
|
dest = 'quiet', help = 'No console logging') |
|
|
|
parser.add_argument('--binary_port', default = None, |
|
|
|
dest = 'binary_port', help = 'Running from binary build') |
|
|
|
parser.add_argument('--nogit', action = 'store_true', |
|
|
|
dest = 'nogit', help = 'No git available') |
|
|
|
|
|
|
@ -37,16 +35,13 @@ def getOptions(base_path, args): |
|
|
|
return options |
|
|
|
|
|
|
|
|
|
|
|
def runCouchPotato(options, base_path, args, handle = None): |
|
|
|
def runCouchPotato(options, base_path, args, desktop = None): |
|
|
|
|
|
|
|
# Load settings |
|
|
|
from couchpotato.environment import Env |
|
|
|
settings = Env.get('settings') |
|
|
|
settings.setFile(options.config_file) |
|
|
|
|
|
|
|
if handle: |
|
|
|
handle(Env) |
|
|
|
|
|
|
|
# Create data dir if needed |
|
|
|
data_dir = os.path.expanduser(Env.setting('data_dir')) |
|
|
|
if data_dir == '': |
|
|
@ -81,7 +76,7 @@ def runCouchPotato(options, base_path, args, handle = None): |
|
|
|
Env.set('cache', FileSystemCache(os.path.join(Env.get('cache_dir'), 'python'))) |
|
|
|
Env.set('console_log', options.console_log) |
|
|
|
Env.set('quiet', options.quiet) |
|
|
|
Env.set('binary_port', options.binary_port) |
|
|
|
Env.set('desktop', desktop) |
|
|
|
Env.set('args', args) |
|
|
|
Env.set('options', options) |
|
|
|
|
|
|
@ -95,7 +90,7 @@ def runCouchPotato(options, base_path, args, handle = None): |
|
|
|
|
|
|
|
# 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 Env.get('desktop'): |
|
|
|
|
|
|
|
# Logger |
|
|
|
logger = logging.getLogger() |
|
|
@ -160,7 +155,7 @@ def runCouchPotato(options, base_path, args, handle = None): |
|
|
|
from couchpotato import app |
|
|
|
api_key = Env.setting('api_key') |
|
|
|
url_base = '/' + Env.setting('url_base').lstrip('/') if Env.setting('url_base') else '' |
|
|
|
reloader = debug is True and not options.binary_port |
|
|
|
reloader = debug is True and not Env.get('desktop') |
|
|
|
|
|
|
|
# Basic config |
|
|
|
app.secret_key = api_key |
|
|
|