本文整理汇总了Python中sickbeard.webserveInit.SRWebServer类的典型用法代码示例。如果您正苦于以下问题:Python SRWebServer类的具体用法?Python SRWebServer怎么用?Python SRWebServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SRWebServer类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: start
#.........这里部分代码省略.........
# Make sure we can write to the config file
if not ek(os.access, sickbeard.CONFIG_FILE, os.W_OK):
if ek(os.path.isfile, sickbeard.CONFIG_FILE):
raise SystemExit('Config file must be writeable: {0}'.format(sickbeard.CONFIG_FILE))
elif not ek(os.access, ek(os.path.dirname, sickbeard.CONFIG_FILE), os.W_OK):
raise SystemExit('Config file root dir must be writeable: {0}'.format(ek(os.path.dirname, sickbeard.CONFIG_FILE)))
ek(os.chdir, sickbeard.DATA_DIR)
# Check if we need to perform a restore first
restore_dir = ek(os.path.join, sickbeard.DATA_DIR, 'restore')
if ek(os.path.exists, restore_dir):
success = self.restore_db(restore_dir, sickbeard.DATA_DIR)
if self.console_logging:
sys.stdout.write('Restore: restoring DB and config.ini {0}!\n'.format(('FAILED', 'SUCCESSFUL')[success]))
# Load the config and publish it to the sickbeard package
if self.console_logging and not ek(os.path.isfile, sickbeard.CONFIG_FILE):
sys.stdout.write('Unable to find {0}, all settings will be default!\n'.format(sickbeard.CONFIG_FILE))
sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)
# Initialize the config and our threads
sickbeard.initialize(consoleLogging=self.console_logging)
if self.run_as_daemon:
self.daemonize()
# Get PID
sickbeard.PID = os.getpid()
# Build from the DB to start with
self.load_shows_from_db()
logger.log('Starting SickRage [{branch}] using \'{config}\''.format
(branch=sickbeard.BRANCH, config=sickbeard.CONFIG_FILE))
self.clear_cache()
if self.forced_port:
logger.log('Forcing web server to port {port}'.format(port=self.forced_port))
self.start_port = self.forced_port
else:
self.start_port = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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':
self.web_host = sickbeard.WEB_HOST
else:
self.web_host = '' if sickbeard.WEB_IPV6 else '0.0.0.0'
# web server options
self.web_options = {
'port': int(self.start_port),
'host': self.web_host,
'data_root': ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME),
'web_root': sickbeard.WEB_ROOT,
'log_dir': self.log_dir,
'username': sickbeard.WEB_USERNAME,
'password': sickbeard.WEB_PASSWORD,
'enable_https': sickbeard.ENABLE_HTTPS,
'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
'https_cert': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
'https_key': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}
# start web server
self.web_server = SRWebServer(self.web_options)
self.web_server.start()
# Fire up all our threads
sickbeard.start()
# Build internal name cache
name_cache.buildNameCache()
# Pre-populate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# Check for metadata indexer updates for shows (sets the next aired ep!)
# sickbeard.showUpdateScheduler.forceRun()
# Launch browser
if sickbeard.LAUNCH_BROWSER and not (self.no_launch or self.run_as_daemon):
sickbeard.launchBrowser('https' if sickbeard.ENABLE_HTTPS else 'http', self.start_port, sickbeard.WEB_ROOT)
# main loop
while True:
time.sleep(1)
开发者ID:DazzFX,项目名称:SickRage,代码行数:101,代码来源:SickBeard.py
示例2: SickRage
#.........这里部分代码省略.........
self.startPort = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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':
self.webhost = sickbeard.WEB_HOST
else:
if sickbeard.WEB_IPV6:
self.webhost = ''
else:
self.webhost = '0.0.0.0'
# web server options
self.web_options = {
'port': int(self.startPort),
'host': self.webhost,
'data_root': ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME),
'web_root': sickbeard.WEB_ROOT,
'log_dir': self.log_dir,
'username': sickbeard.WEB_USERNAME,
'password': sickbeard.WEB_PASSWORD,
'enable_https': sickbeard.ENABLE_HTTPS,
'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
'https_cert': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
'https_key': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}
# start web server
self.webserver = SRWebServer(self.web_options)
self.webserver.start()
if self.consoleLogging:
print "Starting up SickRage " + sickbeard.BRANCH + " from " + sickbeard.CONFIG_FILE
# Clean up after update
if sickbeard.GIT_NEWVER:
toclean = ek(os.path.join, sickbeard.CACHE_DIR, 'mako')
for root, dirs, files in ek(os.walk, toclean, topdown=False):
for name in files:
ek(os.remove, ek(os.path.join, root, name))
for name in dirs:
ek(os.rmdir, ek(os.path.join, root, name))
sickbeard.GIT_NEWVER = False
# Fire up all our threads
sickbeard.start()
# Build internal name cache
name_cache.buildNameCache()
# Prepopulate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# # Check for metadata indexer updates for shows (Disabled until we use api)
# sickbeard.showUpdateScheduler.forceRun()
# Launch browser
开发者ID:jzoch2,项目名称:SickRage,代码行数:67,代码来源:SickBeard.py
示例3: SickRage
#.........这里部分代码省略.........
logger.log('Forcing web server to port {port}'.format(port=self.forced_port))
self.start_port = self.forced_port
else:
self.start_port = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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':
self.web_host = sickbeard.WEB_HOST
else:
self.web_host = '' if sickbeard.WEB_IPV6 else '0.0.0.0'
# web server options
self.web_options = {
'port': int(self.start_port),
'host': self.web_host,
'data_root': ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME),
'web_root': sickbeard.WEB_ROOT,
'log_dir': self.log_dir,
'username': sickbeard.WEB_USERNAME,
'password': sickbeard.WEB_PASSWORD,
'enable_https': sickbeard.ENABLE_HTTPS,
'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
'https_cert': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
'https_key': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}
# start web server
self.web_server = SRWebServer(self.web_options)
self.web_server.start()
# Fire up all our threads
sickbeard.start()
# Build internal name cache
name_cache.buildNameCache()
# Pre-populate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# Check for metadata indexer updates for shows (sets the next aired ep!)
# sickbeard.showUpdateScheduler.forceRun()
# Launch browser
if sickbeard.LAUNCH_BROWSER and not (self.no_launch or self.run_as_daemon):
sickbeard.launchBrowser('https' if sickbeard.ENABLE_HTTPS else 'http', self.start_port, sickbeard.WEB_ROOT)
# main loop
while True:
time.sleep(1)
def daemonize(self):
"""
Fork off as a daemon
"""
# pylint: disable=protected-access
# An object is accessed for a non-existent member.
开发者ID:DazzFX,项目名称:SickRage,代码行数:67,代码来源:SickBeard.py
示例4: SickRage
#.........这里部分代码省略.........
self.startPort = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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':
self.webhost = sickbeard.WEB_HOST
else:
if sickbeard.WEB_IPV6:
self.webhost = '::'
else:
self.webhost = '0.0.0.0'
# web server options
self.web_options = {
'port': int(self.startPort),
'host': self.webhost,
'data_root': ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME),
'web_root': sickbeard.WEB_ROOT,
'log_dir': self.log_dir,
'username': sickbeard.WEB_USERNAME,
'password': sickbeard.WEB_PASSWORD,
'enable_https': sickbeard.ENABLE_HTTPS,
'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
'https_cert': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
'https_key': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}
# start web server
self.webserver = SRWebServer(self.web_options)
self.webserver.start()
if self.consoleLogging:
print "Starting up SickRage " + sickbeard.BRANCH + " from " + sickbeard.CONFIG_FILE
# Clean up after update
if sickbeard.GIT_NEWVER:
toclean = ek(os.path.join, sickbeard.CACHE_DIR, 'mako')
for root, dirs, files in ek(os.walk, toclean, topdown=False):
for name in files:
ek(os.remove, ek(os.path.join, root, name))
for name in dirs:
ek(os.rmdir, ek(os.path.join,root, name))
sickbeard.GIT_NEWVER = False
# Fire up all our threads
sickbeard.start()
# Build internal name cache
name_cache.buildNameCache()
# Prepopulate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# # Check for metadata indexer updates for shows (Disabled until we use api)
# sickbeard.showUpdateScheduler.forceRun()
# Launch browser
开发者ID:fooper,项目名称:SickRage,代码行数:67,代码来源:SickBeard.py
示例5: start
#.........这里部分代码省略.........
restoreDir = ek(os.path.join, sickbeard.DATA_DIR, 'restore')
if ek(os.path.exists, restoreDir):
success = self.restoreDB(restoreDir, sickbeard.DATA_DIR)
if self.consoleLogging:
sys.stdout.write(u"Restore: restoring DB and config.ini %s!\n" % ("FAILED", "SUCCESSFUL")[success])
# Load the config and publish it to the sickbeard package
if self.consoleLogging and not ek(os.path.isfile, sickbeard.CONFIG_FILE):
sys.stdout.write(u"Unable to find '" + sickbeard.CONFIG_FILE + "' , all settings will be default!" + "\n")
sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)
# Initialize the config and our threads
sickbeard.initialize(consoleLogging=self.consoleLogging)
if self.runAsDaemon:
self.daemonize()
# Get PID
sickbeard.PID = os.getpid()
# Build from the DB to start with
self.loadShowsFromDB()
if self.forcedPort:
logger.log(u"Forcing web server to port " + str(self.forcedPort))
self.startPort = self.forcedPort
else:
self.startPort = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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':
self.webhost = sickbeard.WEB_HOST
else:
if sickbeard.WEB_IPV6:
self.webhost = ''
else:
self.webhost = '0.0.0.0'
# web server options
self.web_options = {
'port': int(self.startPort),
'host': self.webhost,
'data_root': ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME),
'web_root': sickbeard.WEB_ROOT,
'log_dir': self.log_dir,
'username': sickbeard.WEB_USERNAME,
'password': sickbeard.WEB_PASSWORD,
'enable_https': sickbeard.ENABLE_HTTPS,
'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
'https_cert': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
'https_key': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}
# start web server
self.webserver = SRWebServer(self.web_options)
self.webserver.start()
if self.consoleLogging:
print "Starting up SickRage " + sickbeard.BRANCH + " from " + sickbeard.CONFIG_FILE
# Clean up after update
if sickbeard.GIT_NEWVER:
toclean = ek(os.path.join, sickbeard.CACHE_DIR, 'mako')
for root, dirs, files in ek(os.walk, toclean, topdown=False):
for name in files:
ek(os.remove, ek(os.path.join, root, name))
for name in dirs:
ek(os.rmdir, ek(os.path.join, root, name))
sickbeard.GIT_NEWVER = False
# Fire up all our threads
sickbeard.start()
# Build internal name cache
name_cache.buildNameCache()
# Prepopulate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# # Check for metadata indexer updates for shows (Disabled until we use api)
# sickbeard.showUpdateScheduler.forceRun()
# Launch browser
if sickbeard.LAUNCH_BROWSER and not (self.noLaunch or self.runAsDaemon):
sickbeard.launchBrowser('https' if sickbeard.ENABLE_HTTPS else 'http', self.startPort, sickbeard.WEB_ROOT)
# main loop
while True:
time.sleep(1)
开发者ID:jzoch2,项目名称:SickRage,代码行数:101,代码来源:SickBeard.py
示例6: SickRage
#.........这里部分代码省略.........
self.startPort = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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':
self.webhost = sickbeard.WEB_HOST
else:
if sickbeard.WEB_IPV6:
self.webhost = '::'
else:
self.webhost = '0.0.0.0'
# web server options
self.web_options = {
'port': int(self.startPort),
'host': self.webhost,
'data_root': os.path.join(sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME),
'web_root': sickbeard.WEB_ROOT,
'log_dir': self.log_dir,
'username': sickbeard.WEB_USERNAME,
'password': sickbeard.WEB_PASSWORD,
'enable_https': sickbeard.ENABLE_HTTPS,
'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
'https_cert': os.path.join(sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
'https_key': os.path.join(sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}
# start web server
self.webserver = SRWebServer(self.web_options)
self.webserver.start()
if self.consoleLogging:
print "Starting up SickRage " + sickbeard.BRANCH + " from " + sickbeard.CONFIG_FILE
# Clean up after update
if sickbeard.GIT_NEWVER:
toclean = os.path.join(sickbeard.CACHE_DIR, 'mako')
for root, dirs, files in os.walk(toclean, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
sickbeard.GIT_NEWVER = False
# Fire up all our threads
sickbeard.start()
# Build internal name cache
name_cache.buildNameCache()
# Prepopulate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# Check for metadata indexer updates for shows (Disabled until we use api)
#sickbeard.showUpdateScheduler.forceRun()
# Launch browser
开发者ID:normtown,项目名称:SickRage,代码行数:67,代码来源:SickBeard.py
示例7: start
#.........这里部分代码省略.........
# Make sure we can write to the config file
if not ek(os.access, sickbeard.CONFIG_FILE, os.W_OK):
if ek(os.path.isfile, sickbeard.CONFIG_FILE):
raise SystemExit("Config file must be writeable: %s" % sickbeard.CONFIG_FILE)
elif not ek(os.access, ek(os.path.dirname, sickbeard.CONFIG_FILE), os.W_OK):
raise SystemExit(
"Config file root dir must be writeable: %s" % ek(os.path.dirname, sickbeard.CONFIG_FILE)
)
ek(os.chdir, sickbeard.DATA_DIR)
# Check if we need to perform a restore first
restore_dir = ek(os.path.join, sickbeard.DATA_DIR, "restore")
if ek(os.path.exists, restore_dir):
success = self.restore_db(restore_dir, sickbeard.DATA_DIR)
if self.console_logging:
sys.stdout.write("Restore: restoring DB and config.ini %s!\n" % ("FAILED", "SUCCESSFUL")[success])
# Load the config and publish it to the sickbeard package
if self.console_logging and not ek(os.path.isfile, sickbeard.CONFIG_FILE):
sys.stdout.write("Unable to find %s, all settings will be default!\n" % sickbeard.CONFIG_FILE)
sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)
# Initialize the config and our threads
sickbeard.initialize(consoleLogging=self.console_logging)
if self.run_as_daemon:
self.daemonize()
# Get PID
sickbeard.PID = os.getpid()
# Build from the DB to start with
self.load_shows_from_db()
logger.log("Starting SickRage [%s] from '%s'" % (sickbeard.BRANCH, sickbeard.CONFIG_FILE))
self.clear_cache()
if self.forced_port:
logger.log("Forcing web server to port %s" % self.forced_port)
self.start_port = self.forced_port
else:
self.start_port = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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":
self.web_host = sickbeard.WEB_HOST
else:
self.web_host = "" if sickbeard.WEB_IPV6 else "0.0.0.0"
# web server options
self.web_options = {
"port": int(self.start_port),
"host": self.web_host,
"data_root": ek(os.path.join, sickbeard.PROG_DIR, "gui", sickbeard.GUI_NAME),
"web_root": sickbeard.WEB_ROOT,
"log_dir": self.log_dir,
"username": sickbeard.WEB_USERNAME,
"password": sickbeard.WEB_PASSWORD,
"enable_https": sickbeard.ENABLE_HTTPS,
"handle_reverse_proxy": sickbeard.HANDLE_REVERSE_PROXY,
"https_cert": ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
"https_key": ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}
# start web server
self.web_server = SRWebServer(self.web_options)
self.web_server.start()
# Fire up all our threads
sickbeard.start()
# Build internal name cache
# name_cache.buildNameCache()
# Pre-populate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# # Check for metadata indexer updates for shows (Disabled until we use api)
# sickbeard.showUpdateScheduler.forceRun()
# Launch browser
if sickbeard.LAUNCH_BROWSER and not (self.no_launch or self.run_as_daemon):
sickbeard.launchBrowser("https" if sickbeard.ENABLE_HTTPS else "http", self.start_port, sickbeard.WEB_ROOT)
# main loop
while True:
time.sleep(1)
开发者ID:adaur,项目名称:SickRage,代码行数:101,代码来源:SickBeard.py
示例8: SickRage
#.........这里部分代码省略.........
logger.log("Forcing web server to port %s" % self.forced_port)
self.start_port = self.forced_port
else:
self.start_port = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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":
self.web_host = sickbeard.WEB_HOST
else:
self.web_host = "" if sickbeard.WEB_IPV6 else "0.0.0.0"
# web server options
self.web_options = {
"port": int(self.start_port),
"host": self.web_host,
"data_root": ek(os.path.join, sickbeard.PROG_DIR, "gui", sickbeard.GUI_NAME),
"web_root": sickbeard.WEB_ROOT,
"log_dir": self.log_dir,
"username": sickbeard.WEB_USERNAME,
"password": sickbeard.WEB_PASSWORD,
"enable_https": sickbeard.ENABLE_HTTPS,
"handle_reverse_proxy": sickbeard.HANDLE_REVERSE_PROXY,
"https_cert": ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
"https_key": ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}
# start web server
self.web_server = SRWebServer(self.web_options)
self.web_server.start()
# Fire up all our threads
sickbeard.start()
# Build internal name cache
# name_cache.buildNameCache()
# Pre-populate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# # Check for metadata indexer updates for shows (Disabled until we use api)
# sickbeard.showUpdateScheduler.forceRun()
# Launch browser
if sickbeard.LAUNCH_BROWSER and not (self.no_launch or self.run_as_daemon):
sickbeard.launchBrowser("https" if sickbeard.ENABLE_HTTPS else "http", self.start_port, sickbeard.WEB_ROOT)
# main loop
while True:
time.sleep(1)
def daemonize(self):
"""
Fork off as a daemon
"""
# pylint: disable=no-member,protected-access
# An object is accessed for a non-existent member.
开发者ID:adaur,项目名称:SickRage,代码行数:67,代码来源:SickBeard.py
示例9: SickRage
#.........这里部分代码省略.........
self.startPort = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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":
self.webhost = sickbeard.WEB_HOST
else:
if sickbeard.WEB_IPV6:
self.webhost = "::"
else:
self.webhost = "0.0.0.0"
# web server options
self.web_options = {
"port": int(self.startPort),
"host": self.webhost,
"data_root": os.path.join(sickbeard.PROG_DIR, "gui", sickbeard.GUI_NAME),
"web_root": sickbeard.WEB_ROOT,
"log_dir": self.log_dir,
"username": sickbeard.WEB_USERNAME,
"password": sickbeard.WEB_PASSWORD,
"enable_https": sickbeard.ENABLE_HTTPS,
"handle_reverse_proxy": sickbeard.HANDLE_REVERSE_PROXY,
"https_cert": os.path.join(sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
"https_key": os.path.join(sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}
# start web server
self.webserver = SRWebServer(self.web_options)
self.webserver.start()
if self.consoleLogging:
print "Starting up SickRage " + sickbeard.BRANCH + " from " + sickbeard.CONFIG_FILE
# Clean up after update
if sickbeard.GIT_NEWVER:
toclean = os.path.join(sickbeard.CACHE_DIR, "mako")
for root, dirs, files in os.walk(toclean, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
sickbeard.GIT_NEWVER = False
# Fire up all our threads
sickbeard.start()
# Build internal name cache
name_cache.buildNameCache()
# Prepopulate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# # Check for metadata indexer updates for shows (Disabled until we use api)
# sickbeard.showUpdateScheduler.forceRun()
# Launch browser
开发者ID:repmeer,项目名称:SickRage,代码行数:67,代码来源:SickBeard.py
示例10: start
#.........这里部分代码省略.........
raise SystemExit(
"Config file root dir '" + ek(os.path.dirname, sickbeard.CONFIG_FILE) + "' must be writeable.")
ek(os.chdir, sickbeard.DATA_DIR)
# Check if we need to perform a restore first
restoreDir = ek(os.path.join, sickbeard.DATA_DIR, 'restore')
if ek(os.path.exists, restoreDir):
success = self.restoreDB(restoreDir, sickbeard.DATA_DIR)
if self.consoleLogging:
sys.stdout.write("Restore: restoring DB and config.ini %s!\n" % ("FAILED", "SUCCESSFUL")[success])
# Load the config and publish it to the sickbeard package
if self.consoleLogging and not ek(os.path.isfile, sickbeard.CONFIG_FILE):
sys.stdout.write("Unable to find '" + sickbeard.CONFIG_FILE + "' , all settings will be default!" + "\n")
sickbeard.CFG = ConfigObj(sickbeard.CONFIG_FILE)
# Initialize the config and our threads
sickbeard.initialize(consoleLogging=self.consoleLogging)
if self.runAsDaemon:
self.daemonize()
# Get PID
sickbeard.PID = os.getpid()
# Build from the DB to start with
self.loadShowsFromDB()
if self.forcedPort:
logging.info("Forcing web server to port " + str(self.forcedPort))
self.startPort = self.forcedPort
else:
self.startPort = sickbeard.WEB_PORT
if sickbeard.WEB_LOG:
self.log_dir = sickbeard.LOG_DIR
else:
self.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':
self.webhost = sickbeard.WEB_HOST
else:
if sickbeard.WEB_IPV6:
self.webhost = '::'
else:
self.webhost = '0.0.0.0'
# start tornado web server
self.webserver = SRWebServer({
'port': int(self.startPort),
'host': self.webhost,
'data_root': ek(os.path.join, sickbeard.PROG_DIR, 'gui', sickbeard.GUI_NAME),
'web_root': sickbeard.WEB_ROOT,
'log_dir': self.log_dir,
'username': sickbeard.WEB_USERNAME,
'password': sickbeard.WEB_PASSWORD,
'enable_https': sickbeard.ENABLE_HTTPS,
'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
'https_cert': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_CERT),
'https_key': ek(os.path.join, sickbeard.PROG_DIR, sickbeard.HTTPS_KEY),
}).start()
# Clean up after update
if sickbeard.GIT_NEWVER:
toclean = ek(os.path.join, sickbeard.CACHE_DIR, 'mako')
for root, dirs, files in ek(os.walk, toclean, topdown=False):
for name in files:
ek(os.remove, ek(os.path.join, root, name))
for name in dirs:
ek(os.rmdir, ek(os.path.join, root, name))
sickbeard.GIT_NEWVER = False
# Fire up all our threads
logging.info("Starting SiCKRAGE BRANCH:[{}] CONFIG:[{}]".format(sickbeard.BRANCH, sickbeard.CONFIG_FILE))
sickbeard.start()
# Build internal name cache
name_cache.buildNameCache()
# Prepopulate network timezones, it isn't thread safe
network_timezones.update_network_dict()
# sure, why not?
if sickbeard.USE_FAILED_DOWNLOADS:
failed_history.trimHistory()
# # Check for metadata indexer updates for shows (Disabled until we use api)
# sickbeard.showUpdateScheduler.forceRun()
# Launch browser
if sickbeard.LAUNCH_BROWSER and not (self.noLaunch or self.runAsDaemon):
sickbeard.launchBrowser('https' if sickbeard.ENABLE_HTTPS else 'http', self.startPort, sickbeard.WEB_ROOT)
# main loop
while True:
time.sleep(1)
开发者ID:Sinap,项目名称:SickRage,代码行数:101,代码来源:SickBeard.py
注:本文中的sickbeard.webserveInit.SRWebServer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论