当前位置: 首页>>代码示例>>Python>>正文


Python webserveInit.initWebServer函数代码示例

本文整理汇总了Python中sickbeard.webserveInit.initWebServer函数的典型用法代码示例。如果您正苦于以下问题:Python initWebServer函数的具体用法?Python initWebServer怎么用?Python initWebServer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了initWebServer函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

    def run(self):
        global restart, startPort, forceUpdate, noLaunch, web_options

        # Use this PID for everything
        sickbeard.PID = os.getpid()

        try:
            webserveInit.initWebServer(web_options)
        except IOError:
            logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
            if sickbeard.LAUNCH_BROWSER and not sickbeard.DAEMON:
                logger.log(u"Launching browser and exiting", logger.ERROR)
                sickbeard.launchBrowser(startPort)
            sys.exit()

        # Fire up all our threads
        sickbeard.start()

        # Launch browser if we're supposed to
        if sickbeard.LAUNCH_BROWSER and not noLaunch:
            sickbeard.launchBrowser(startPort)

        if sickbeard.LAUNCH_BROWSER and not (noLaunch or sickbeard.DAEMON or restart):
            sickbeard.launchBrowser(startPort)

        # reset this if sickrage was restarted
        restart = False

        # start IO loop
        IOLoop.current().start()

        # close IO loop
        IOLoop.current().close(True)

        # stop all tasks
        sickbeard.halt()

        # save all shows to DB
        sickbeard.saveAll()
开发者ID:BeegorMif,项目名称:HTPC-Manager,代码行数:39,代码来源:SickBeard.py

示例2: main


#.........这里部分代码省略.........

    # Make sure we can write to the data dir
    if not os.access(sickbeard.DATA_DIR, os.W_OK):
        sys.exit("Data directory: " + sickbeard.DATA_DIR + " must be writable (write permissions). Exiting.")

    # Make sure we can write to the config file
    if not os.access(sickbeard.CONFIG_FILE, os.W_OK):
        if os.path.isfile(sickbeard.CONFIG_FILE):
            sys.exit("Config file: " + sickbeard.CONFIG_FILE + " must be writeable (write permissions). Exiting.")
        elif not os.access(os.path.dirname(sickbeard.CONFIG_FILE), os.W_OK):
            sys.exit("Config file directory: " + os.path.dirname(sickbeard.CONFIG_FILE) + " must be writeable (write permissions). Exiting")

    os.chdir(sickbeard.DATA_DIR)

    if consoleLogging:
        sys.stdout.write("Starting up Sick Beard " + SICKBEARD_VERSION + "\n")
        if not os.path.isfile(sickbeard.CONFIG_FILE):
            sys.stdout.write("Unable to find '" + sickbeard.CONFIG_FILE + "' , all settings will be default!" + "\n")

    # Load the config and publish it to the sickbeard package
    sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)

    # Initialize the config and our threads
    sickbeard.initialize(consoleLogging=consoleLogging)

    sickbeard.showList = []

    if sickbeard.DAEMON:
        daemonize()

    # Use this PID for everything
    sickbeard.PID = os.getpid()

    if forcedPort:
        logger.log(u"Forcing web server to port " + str(forcedPort))
        startPort = forcedPort
    else:
        startPort = sickbeard.WEB_PORT

    if sickbeard.WEB_LOG:
        log_dir = sickbeard.LOG_DIR
    else:
        log_dir = None

    # sickbeard.WEB_HOST is available as a configuration value in various
    # places but is not configurable. It is supported here for historic reasons.
    if sickbeard.WEB_HOST and sickbeard.WEB_HOST != '0.0.0.0':
        webhost = sickbeard.WEB_HOST
    else:
        if sickbeard.WEB_IPV6:
            webhost = '::'
        else:
            webhost = '0.0.0.0'

    try:
        initWebServer({
                      'port': startPort,
                      'host': webhost,
                      'data_root': os.path.join(sickbeard.PROG_DIR, 'data'),
                      'web_root': sickbeard.WEB_ROOT,
                      'log_dir': log_dir,
                      'username': sickbeard.WEB_USERNAME,
                      'password': sickbeard.WEB_PASSWORD,
                      'enable_https': sickbeard.ENABLE_HTTPS,
                      'https_cert': sickbeard.HTTPS_CERT,
                      'https_key': sickbeard.HTTPS_KEY,
                      'whitelist': sickbeard.WEB_WHITELIST,
                      })
    except IOError:
        logger.log(u"Unable to start web server, is something else running on port: " + str(startPort), logger.ERROR)
        if sickbeard.LAUNCH_BROWSER and not sickbeard.DAEMON:
            logger.log(u"Launching browser and exiting", logger.ERROR)
            sickbeard.launchBrowser(startPort)
        sys.exit("Unable to start web server, is something else running on port: " + str(startPort))

    # Build from the DB to start with
    logger.log(u"Loading initial show list")
    loadShowsFromDB()

    # Fire up all our threads
    sickbeard.start()

    # Launch browser if we're supposed to
    if sickbeard.LAUNCH_BROWSER and not noLaunch and not sickbeard.DAEMON:
        sickbeard.launchBrowser(startPort)

    # Start an update if we're supposed to
    if forceUpdate:
        sickbeard.showUpdateScheduler.action.run(force=True)  # @UndefinedVariable

    # Stay alive while my threads do the work
    while (True):

        if sickbeard.invoked_command:
            sickbeard.invoked_command()
            sickbeard.invoked_command = None

        time.sleep(1)

    return
开发者ID:pcjacobse,项目名称:Sick-Beard,代码行数:101,代码来源:SickBeard.py

示例3: initWebServer

    # reasons.
    if sickbeard.WEB_HOST and sickbeard.WEB_HOST != '0.0.0.0':
        webhost = sickbeard.WEB_HOST
    else:
        if sickbeard.WEB_IPV6:
            webhost = '::'
        else:
            webhost = '0.0.0.0'

    try:
        initWebServer({
                'port': startPort,
                'host': webhost,
                'data_root': os.path.join(sickbeard.PROG_DIR, 'data'),
                'web_root': sickbeard.WEB_ROOT,
                'log_dir': log_dir,
                'username': sickbeard.WEB_USERNAME,
                'password': sickbeard.WEB_PASSWORD,
                'enable_https': sickbeard.ENABLE_HTTPS,
                'https_cert': sickbeard.HTTPS_CERT,
                'https_key': sickbeard.HTTPS_KEY,
        })
    except IOError:
        logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
        if sickbeard.LAUNCH_BROWSER and not sickbeard.DAEMON:
            logger.log(u"Launching browser and exiting", logger.ERROR)
            sickbeard.launchBrowser(startPort)
        sys.exit()

    # build from the DB to start with
    logger.log(u"Loading initial show list")
    loadShowsFromDB()
开发者ID:msware,项目名称:Sick-Beard,代码行数:32,代码来源:SickBeard.py

示例4: main

def main():

	# use this pid for everything
	sickbeard.PID = os.getpid()

	# do some preliminary stuff
	sickbeard.MY_FULLNAME = os.path.normpath(os.path.abspath(sys.argv[0]))
	sickbeard.MY_NAME = os.path.basename(sickbeard.MY_FULLNAME)
	sickbeard.PROG_DIR = os.path.dirname(sickbeard.MY_FULLNAME)
	sickbeard.MY_ARGS = sys.argv[1:]

	sickbeard.CONFIG_FILE = os.path.join(sickbeard.PROG_DIR, "config.ini")

	# need console logging for SickBeard.py and SickBeard-console.exe
	consoleLogging = (not hasattr(sys, "frozen")) or (sickbeard.MY_NAME.lower().find('-console') > 0)

	# rename the main thread
	threading.currentThread().name = "MAIN"

	try:
		opts, args = getopt.getopt(sys.argv[1:], "qfp:", ['quiet', 'force-update', 'port=', 'tvbinz'])
	except getopt.GetoptError:
		print "Available options: --quiet, --forceupdate, --port"
		sys.exit()

	forceUpdate = False
	forcedPort = None

	for o, a in opts:
		# for now we'll just silence the logging
		if (o in ('-q', '--quiet')):
			consoleLogging = False
		# for now we'll just silence the logging
		if (o in ('--tvbinz')):
			sickbeard.SHOW_TVBINZ = True

		# should we update right away?
		if (o in ('-f', '--forceupdate')):
			forceUpdate = True

		# should we update right away?
		if (o in ('-p', '--port')):
			forcedPort = int(a)

	if consoleLogging:
		print "Starting up Sick Beard "+SICKBEARD_VERSION+" from " + sickbeard.CONFIG_FILE

	# load the config and publish it to the sickbeard package
	if not os.path.isfile(sickbeard.CONFIG_FILE):
		logger.log(u"Unable to find config.ini, all settings will be default", logger.ERROR)

	sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)

	# initialize the config and our threads
	sickbeard.initialize(consoleLogging=consoleLogging)

	sickbeard.showList = []

	if forcedPort:
		logger.log(u"Forcing web server to port "+str(forcedPort))
		startPort = forcedPort
	else:
		startPort = sickbeard.WEB_PORT

	logger.log(u"Starting Sick Beard on http://localhost:"+str(startPort))

	if sickbeard.WEB_LOG:
		log_dir = sickbeard.LOG_DIR
	else:
		log_dir = None

	# sickbeard.WEB_HOST is available as a configuration value in various
	# places but is not configurable. It is supported here for historic
	# reasons.
	if sickbeard.WEB_HOST and sickbeard.WEB_HOST != '0.0.0.0':
		webhost = sickbeard.WEB_HOST
	else:
		if sickbeard.WEB_IPV6:
			webhost = '::'
		else:
			webhost = '0.0.0.0'

	try:
		initWebServer({
		        'port':      startPort,
		        'host':      webhost,
		        'data_root': os.path.join(sickbeard.PROG_DIR, 'data'),
		        'web_root':  sickbeard.WEB_ROOT,
		        'log_dir':   log_dir,
		        'username':  sickbeard.WEB_USERNAME,
		        'password':  sickbeard.WEB_PASSWORD,
		})
	except IOError:
		logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
		if sickbeard.LAUNCH_BROWSER:
			logger.log(u"Launching browser and exiting", logger.ERROR)
			sickbeard.launchBrowser(startPort)
		sys.exit()

	# build from the DB to start with
#.........这里部分代码省略.........
开发者ID:DaveWhite,项目名称:Sick-Beard,代码行数:101,代码来源:SickBeard.py

示例5: str

    if sickbeard.WEB_HOST and sickbeard.WEB_HOST != '0.0.0.0':
        webhost = sickbeard.WEB_HOST
    else:
        if sickbeard.WEB_IPV6:
            webhost = '::'
        else:
            webhost = '0.0.0.0'

    logger.log(u"Starting Sick Beard on http://" + str(webhost) + ":" + str(startPort) + "/")

    try:
        initWebServer({
                'port': startPort,
                'host': webhost,
                'data_root': os.path.join(sickbeard.PROG_DIR, 'data'),
                'web_root': sickbeard.WEB_ROOT,
                'log_dir': log_dir,
                'username': sickbeard.WEB_USERNAME,
                'password': sickbeard.WEB_PASSWORD,
        })
    except IOError:
        logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
        if sickbeard.LAUNCH_BROWSER:
            logger.log(u"Launching browser and exiting", logger.ERROR)
            sickbeard.launchBrowser(startPort)
        sys.exit()

    # build from the DB to start with
    logger.log(u"Loading initial show list")
    loadShowsFromDB()
开发者ID:daemox,项目名称:Sick-Beard,代码行数:30,代码来源:SickBeard.py

示例6: main


#.........这里部分代码省略.........
        # should we update right away?
        if o in ("-f", "--forceupdate"):
            forceUpdate = True

        # use a different port
        if o in ("-p", "--port"):
            forcedPort = int(a)

        # Run as a daemon
        if o in ("-d", "--daemon"):
            if sys.platform == "win32":
                print "Daemonize not supported under Windows, starting normally"
            else:
                consoleLogging = False
                sickbeard.DAEMON = True

    if consoleLogging:
        print "Starting up Sick Beard " + SICKBEARD_VERSION + " from " + sickbeard.CONFIG_FILE

    # load the config and publish it to the sickbeard package
    if not os.path.isfile(sickbeard.CONFIG_FILE):
        logger.log(u"Unable to find config.ini, all settings will be default", logger.ERROR)

    sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)

    # initialize the config and our threads
    sickbeard.initialize(consoleLogging=consoleLogging)

    sickbeard.showList = []

    if sickbeard.DAEMON:
        daemonize()

    # use this pid for everything
    sickbeard.PID = os.getpid()

    if forcedPort:
        logger.log(u"Forcing web server to port " + str(forcedPort))
        startPort = forcedPort
    else:
        startPort = sickbeard.WEB_PORT

    logger.log(u"Starting Sick Beard on http://localhost:" + str(startPort))

    if sickbeard.WEB_LOG:
        log_dir = sickbeard.LOG_DIR
    else:
        log_dir = None

    # sickbeard.WEB_HOST is available as a configuration value in various
    # places but is not configurable. It is supported here for historic
    # reasons.
    if sickbeard.WEB_HOST and sickbeard.WEB_HOST != "0.0.0.0":
        webhost = sickbeard.WEB_HOST
    else:
        if sickbeard.WEB_IPV6:
            webhost = "::"
        else:
            webhost = "0.0.0.0"

    try:
        initWebServer(
            {
                "port": startPort,
                "host": webhost,
                "data_root": os.path.join(sickbeard.PROG_DIR, "data"),
                "web_root": sickbeard.WEB_ROOT,
                "log_dir": log_dir,
                "username": sickbeard.WEB_USERNAME,
                "password": sickbeard.WEB_PASSWORD,
            }
        )
    except IOError:
        logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
        if sickbeard.LAUNCH_BROWSER:
            logger.log(u"Launching browser and exiting", logger.ERROR)
            sickbeard.launchBrowser(startPort)
        sys.exit()

    # build from the DB to start with
    logger.log(u"Loading initial show list")
    loadShowsFromDB()

    # fire up all our threads
    sickbeard.start()

    # launch browser if we're supposed to
    if sickbeard.LAUNCH_BROWSER:
        sickbeard.launchBrowser(startPort)

    # start an update if we're supposed to
    if forceUpdate:
        sickbeard.showUpdateScheduler.action.run(force=True)

    # stay alive while my threads do the work
    while True:

        time.sleep(1)

    return
开发者ID:bergvandenp,项目名称:Sick-Beard,代码行数:101,代码来源:SickBeard.py

示例7: initWebServer

    if sickbeard.WEB_HOST and sickbeard.WEB_HOST != '0.0.0.0':
        webhost = sickbeard.WEB_HOST
    else:
        if sickbeard.WEB_IPV6:
            webhost = '::'
        else:
            webhost = '0.0.0.0'

    try:
        initWebServer({
            'port': startPort,
            'host': webhost,
            'data_root': os.path.join(sickbeard.PROG_DIR, 'gui/' + sickbeard.GUI_NAME),
            'web_root': sickbeard.WEB_ROOT,
            'log_dir': log_dir,
            'username': sickbeard.WEB_USERNAME,
            'password': sickbeard.WEB_PASSWORD,
            'enable_https': sickbeard.ENABLE_HTTPS,
            'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
            'https_cert': sickbeard.HTTPS_CERT,
            'https_key': sickbeard.HTTPS_KEY,
        })
    except IOError:
        logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
        if sickbeard.LAUNCH_BROWSER and not sickbeard.DAEMON:
            logger.log(u"Launching browser and exiting", logger.ERROR)
            sickbeard.launchBrowser(startPort)
        sys.exit()

    # Build from the DB to start with
    logger.log(u"Loading initial show list")
开发者ID:Davejje,项目名称:SickRage,代码行数:31,代码来源:SickBeard.py

示例8: int

    options = {
        'port': int(startPort),
        'host': webhost,
        'data_root': os.path.join(sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME),
        'web_root': sickbeard.WEB_ROOT,
        'log_dir': log_dir,
        'username': sickbeard.WEB_USERNAME,
        'password': sickbeard.WEB_PASSWORD,
        'enable_https': sickbeard.ENABLE_HTTPS,
        'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
        'https_cert': sickbeard.HTTPS_CERT,
        'https_key': sickbeard.HTTPS_KEY,
    }

    # init tornado
    webserveInit.initWebServer(options)

    # Build from the DB to start with
    logger.log(u"Loading initial show list")
    loadShowsFromDB()

    def startup():
        # Fire up all our threads
        sickbeard.start()

        # Launch browser if we're supposed to
        if sickbeard.LAUNCH_BROWSER and not noLaunch and not sickbeard.DAEMON:
            sickbeard.launchBrowser(startPort)

        # Start an update if we're supposed to
        if forceUpdate or sickbeard.UPDATE_SHOWS_ON_START:
开发者ID:dnssyste,项目名称:SickRage,代码行数:31,代码来源:SickBeard.py

示例9: main

def main():

	# do some preliminary stuff
	sickbeard.MY_FULLNAME = os.path.normpath(os.path.abspath(sys.argv[0]))
	sickbeard.MY_NAME = os.path.basename(sickbeard.MY_FULLNAME)
	sickbeard.PROG_DIR = os.path.dirname(sickbeard.MY_FULLNAME)

	config_file = os.path.join(sickbeard.PROG_DIR, "config.ini")

	# need console logging for SickBeard.py and SickBeard-console.exe
	consoleLogging = (not hasattr(sys, "frozen")) or (sickbeard.MY_NAME.lower().find('-console') > 0)

	# rename the main thread
	threading.currentThread().name = "MAIN"

	try:
		opts, args = getopt.getopt(sys.argv[1:], "q", ['quiet'])
	except getopt.GetoptError:
		print "Available options: --quiet"
		sys.exit()
	
	for o, a in opts:
		# for now we'll just silence the logging
		if (o in ('-q', '--quiet')):
			consoleLogging = False
	
	if consoleLogging:
		print "Starting up Sick Beard "+SICKBEARD_VERSION+" from " + config_file
	
	# load the config and publish it to the sickbeard package
	if not os.path.isfile(config_file):
		logger.log("Unable to find config.ini, all settings will be default", logger.ERROR)

	sickbeard.CFG = ConfigObj(config_file)

	# initialize the config and our threads
	sickbeard.initialize(consoleLogging=consoleLogging)

	sickbeard.showList = []

	try:
		initWebServer({
		        'port':      sickbeard.WEB_PORT,
		        'data_root': os.path.join(sickbeard.PROG_DIR, 'data'),
		        'web_root':  sickbeard.WEB_ROOT,
		        'log_dir':   sickbeard.LOG_DIR if sickbeard.WEB_LOG else None,
		        'username':  sickbeard.WEB_USERNAME,
		        'password':  sickbeard.WEB_PASSWORD,
		})
	except IOError:
		logger.log("Unable to start web server, is something else running on port %d?" % sickbeard.WEB_PORT, logger.ERROR)
		if sickbeard.LAUNCH_BROWSER:
			logger.log("Launching browser and exiting", logger.ERROR)
			sickbeard.launchBrowser()
		sys.exit()

	# build from the DB to start with
	logger.log("Loading initial show list")
	loadShowsFromDB()

	# set up the lists
	sickbeard.updateAiringList()
	sickbeard.updateComingList()
	sickbeard.updateMissingList()
	
	# fire up all our threads
	sickbeard.start()

	# launch browser if we're supposed to
	if sickbeard.LAUNCH_BROWSER:
		sickbeard.launchBrowser()

	# stay alive while my threads do the work
	while (True):
		
		time.sleep(1)
	
	return
开发者ID:basti1,项目名称:Sick-Beard,代码行数:78,代码来源:SickBeard.py

示例10: initWebServer

    # reasons.
    if sickbeard.WEB_HOST and sickbeard.WEB_HOST != "0.0.0.0":
        webhost = sickbeard.WEB_HOST
    else:
        if sickbeard.WEB_IPV6:
            webhost = "::"
        else:
            webhost = "0.0.0.0"

    try:
        initWebServer(
            {
                "port": startPort,
                "host": webhost,
                "data_root": os.path.join(sickbeard.PROG_DIR, "data"),
                "web_root": sickbeard.WEB_ROOT,
                "log_dir": log_dir,
                "username": "sbuser",
                "password": "sbpass",
            }
        )
    except IOError:
        logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
        if sickbeard.LAUNCH_BROWSER:
            logger.log(u"Launching browser and exiting", logger.ERROR)
            sickbeard.launchBrowser(startPort)
        sys.exit()

    # build from the DB to start with
    logger.log(u"Loading initial show list")
    loadShowsFromDB()
开发者ID:natem345,项目名称:Sick-Beard,代码行数:31,代码来源:SickBeard.py

示例11: create_https_certificates

            create_https_certificates('server.crt', 'server.key')
            sickbeard.SSL_CERT_FILE = os.path.join(os.getcwd(),'server.crt')
            sickbeard.SSL_KEY_FILE =  os.path.join(os.getcwd(),'server.key')
        if not(sickbeard.SSL_CERT_FILE != "" and os.path.exists(sickbeard.SSL_CERT_FILE)) or not (sickbeard.SSL_KEY_FILE != "" and os.path.exists(sickbeard.SSL_KEY_FILE)) :
            logger.log(u"Unable to start webserver with SSL. Configured certificate or key does not exist.")
            sickbeard.WEB_SSL = 0

    logger.log(u"Starting Sick Beard on http(s)://" + str(webhost) + ":" + str(startPort) + "/")

    try:
        initWebServer({
                'port': startPort,
                'host': webhost,
                'data_root': os.path.join(sickbeard.PROG_DIR, 'data'),
                'web_root': sickbeard.WEB_ROOT,
                'log_dir': log_dir,
                'username': sickbeard.WEB_USERNAME,
                'password': sickbeard.WEB_PASSWORD,
                'web_ssl' : sickbeard.WEB_SSL,
                'server_certificate': sickbeard.SSL_CERT_FILE,
                'server_key' :  sickbeard.SSL_KEY_FILE,
        })
    except IOError:
        logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
        if sickbeard.LAUNCH_BROWSER:
            logger.log(u"Launching browser and exiting", logger.ERROR)
            sickbeard.launchBrowser(startPort)
        sys.exit()

    # build from the DB to start with
    logger.log(u"Loading initial show list")
    loadShowsFromDB()
开发者ID:msoute,项目名称:Sick-Beard,代码行数:32,代码来源:SickBeard.py

示例12: initWebServer

        webhost = sickbeard.WEB_HOST
    else:
        if sickbeard.WEB_IPV6:
            webhost = "::"
        else:
            webhost = "0.0.0.0"

    try:
        initWebServer(
            {
                "port": startPort,
                "host": webhost,
                "data_root": os.path.join(sickbeard.PROG_DIR, "gui/" + sickbeard.GUI_NAME),
                "web_root": sickbeard.WEB_ROOT,
                "log_dir": log_dir,
                "username": sickbeard.WEB_USERNAME,
                "password": sickbeard.WEB_PASSWORD,
                "enable_https": sickbeard.ENABLE_HTTPS,
                "handle_reverse_proxy": sickbeard.HANDLE_REVERSE_PROXY,
                "https_cert": sickbeard.HTTPS_CERT,
                "https_key": sickbeard.HTTPS_KEY,
            }
        )
    except IOError:
        logger.log(u"Unable to start web server, is something else running on port %d?" % startPort, logger.ERROR)
        if sickbeard.LAUNCH_BROWSER and not sickbeard.DAEMON:
            logger.log(u"Launching browser and exiting", logger.ERROR)
            sickbeard.launchBrowser(startPort)
        sys.exit()

    # Build from the DB to start with
开发者ID:EchelonFour,项目名称:SickRage,代码行数:31,代码来源:SickBeard.py

示例13: main

def main():

    # do some preliminary stuff
    sickbeard.MY_FULLNAME = os.path.normpath(os.path.abspath(sys.argv[0]))
    sickbeard.MY_NAME = os.path.basename(sickbeard.MY_FULLNAME)
    sickbeard.PROG_DIR = os.path.dirname(sickbeard.MY_FULLNAME)

    config_file = os.path.join(sickbeard.PROG_DIR, "config.ini")

    # need console logging for SickBeard.py and SickBeard-console.exe
    consoleLogging = (not hasattr(sys, "frozen")) or (sickbeard.MY_NAME.lower().find("-console") > 0)

    # rename the main thread
    threading.currentThread().name = "MAIN"

    try:
        opts, args = getopt.getopt(sys.argv[1:], "qfp:", ["quiet", "force-update", "port=", "tvbinz"])
    except getopt.GetoptError:
        print "Available options: --quiet, --forceupdate, --port"
        sys.exit()

    forceUpdate = False
    forcedPort = None

    for o, a in opts:
        # for now we'll just silence the logging
        if o in ("-q", "--quiet"):
            consoleLogging = False
            # for now we'll just silence the logging
        if o in ("--tvbinz"):
            sickbeard.SHOW_TVBINZ = True

            # should we update right away?
        if o in ("-f", "--forceupdate"):
            forceUpdate = True

            # should we update right away?
        if o in ("-p", "--port"):
            forcedPort = int(a)

    if consoleLogging:
        print "Starting up Sick Beard " + SICKBEARD_VERSION + " from " + config_file

        # load the config and publish it to the sickbeard package
    if not os.path.isfile(config_file):
        logger.log("Unable to find config.ini, all settings will be default", logger.ERROR)

    sickbeard.CFG = ConfigObj(config_file)

    # initialize the config and our threads
    sickbeard.initialize(consoleLogging=consoleLogging)

    sickbeard.showList = []

    if forcedPort:
        logger.log("Forcing web server to port " + str(forcedPort))
        startPort = forcedPort
    else:
        startPort = sickbeard.WEB_PORT

    logger.log("Starting Sick Beard on http://localhost:" + str(startPort))

    try:
        initWebServer(
            {
                "port": startPort,
                "data_root": os.path.join(sickbeard.PROG_DIR, "data"),
                "web_root": sickbeard.WEB_ROOT,
                "log_dir": sickbeard.LOG_DIR if sickbeard.WEB_LOG else None,
                "username": sickbeard.WEB_USERNAME,
                "password": sickbeard.WEB_PASSWORD,
            }
        )
    except IOError:
        logger.log(
            "Unable to start web server, is something else running on port %d?" % sickbeard.WEB_PORT, logger.ERROR
        )
        if sickbeard.LAUNCH_BROWSER:
            logger.log("Launching browser and exiting", logger.ERROR)
            sickbeard.launchBrowser()
        sys.exit()

        # build from the DB to start with
    logger.log("Loading initial show list")
    loadShowsFromDB()

    # set up the lists
    sickbeard.updateAiringList()
    sickbeard.updateComingList()
    sickbeard.updateMissingList()

    # fire up all our threads
    sickbeard.start()

    # launch browser if we're supposed to
    if sickbeard.LAUNCH_BROWSER:
        sickbeard.launchBrowser()

        # start an update if we're supposed to
    if forceUpdate:
#.........这里部分代码省略.........
开发者ID:pairofdimes,项目名称:Sick-Beard,代码行数:101,代码来源:SickBeard.py


注:本文中的sickbeard.webserveInit.initWebServer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。