From 6cc97a17cd2109f8e75039d7417ab5ee5d1b22d3 Mon Sep 17 00:00:00 2001 From: panni Date: Wed, 31 Oct 2018 18:09:46 +0100 Subject: make bazarr a module; use centralized getopt in daemon; add --debug option for console handler; add logging dependencies --- bazarr.py | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'bazarr.py') diff --git a/bazarr.py b/bazarr.py index 405158a2b..5411e6585 100644 --- a/bazarr.py +++ b/bazarr.py @@ -3,35 +3,14 @@ import threading import time import os import sys -import getopt - -config_dir = os.path.join(os.path.dirname(__file__), 'data/') -no_update = False - -arguments = [] -try: - opts, args = getopt.getopt(sys.argv[1:],"h:",["no-update", "config="]) -except getopt.GetoptError: - print 'bazarr.py -h --no-update --config ' - sys.exit(2) -for opt, arg in opts: - arguments.append(opt) - if arg != '': - arguments.append(arg) - - if opt == '-h': - print 'bazarr.py -h --no-update --config ' - sys.exit() - elif opt in ("--no-update"): - no_update = True - elif opt in ("--config"): - config_dir = arg +from bazarr.get_argv import config_dir, arguments dir_name = os.path.dirname(__file__) + def start_bazarr(): - script = [sys.executable, "-u", os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr/main.py'))] + globals()['arguments'] + script = [sys.executable, "-u", os.path.normcase(os.path.join(globals()['dir_name'], 'bazarr/main.py'))] + arguments ep = sp.Popen(script, stdout=sp.PIPE, stderr=sp.STDOUT, stdin=sp.PIPE) print "Bazarr starting..." -- cgit v1.2.3