本文整理汇总了Python中monitor.Monitor.scan方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.scan方法的具体用法?Python Monitor.scan怎么用?Python Monitor.scan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monitor.Monitor
的用法示例。
在下文中一共展示了Monitor.scan方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: APIServer
# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import scan [as 别名]
class APIServer(tornado.web.Application):
def __init__(self, config, opts):
utils.fix_output_encoding()
self.config = config
self.opts = opts
self.port = self.config['general']['port']
self.webroot = self.config['general']['webroot']
self.comicArchiveList = []
#if len(self.config['general']['folder_list']) == 0:
# logging.error("No folders on either command-line or config file. Quitting.")
# sys.exit(-1)
self.dm = DataManager()
self.library = Library(self.dm.Session)
if opts.reset or opts.reset_and_run:
logging.info( "Deleting any existing database!")
self.dm.delete()
# quit on a standard reset
if opts.reset:
sys.exit(0)
try:
self.dm.create()
except SchemaVersionException as e:
msg = "Couldn't open database. Probably the schema has changed."
logging.error(msg)
utils.alert("Schema change", msg)
sys.exit(-1)
try:
self.listen(self.port, no_keep_alive = True)
except Exception as e:
logging.error(e)
msg = "Couldn't open socket on port {0}. (Maybe ComicStreamer is already running?) Quitting.".format(self.port)
logging.error(msg)
utils.alert("Port not available", msg)
sys.exit(-1)
logging.info( "Stream server running on port {0}...".format(self.port))
#http_server = tornado.httpserver.HTTPServer(self, no_keep_alive = True, ssl_options={
# "certfile": "server.crt",
# "keyfile": "server.key",
#})
#http_server.listen(port+1)
self.version = csversion.version
handlers = [
# Web Pages
(self.webroot + r"/", MainHandler),
(self.webroot + r"/(.*)\.html", GenericPageHandler),
(self.webroot + r"/about", AboutPageHandler),
(self.webroot + r"/control", ControlPageHandler),
(self.webroot + r"/configure", ConfigPageHandler),
(self.webroot + r"/log", LogPageHandler),
(self.webroot + r"/comiclist/browse", ComicListBrowserHandler),
(self.webroot + r"/folders/browse(/.*)*", FoldersBrowserHandler),
(self.webroot + r"/entities/browse(/.*)*", EntitiesBrowserHandler),
(self.webroot + r"/comic/([0-9]+)/reader", ReaderHandler),
(self.webroot + r"/login", LoginHandler),
# Data
(self.webroot + r"/dbinfo", DBInfoAPIHandler),
(self.webroot + r"/version", VersionAPIHandler),
(self.webroot + r"/deleted", DeletedAPIHandler),
(self.webroot + r"/comic/([0-9]+)", ComicAPIHandler),
(self.webroot + r"/comiclist", ComicListAPIHandler),
(self.webroot + r"/comic/([0-9]+)/page/([0-9]+|clear)/bookmark", ComicBookmarkAPIHandler ),
(self.webroot + r"/comic/([0-9]+)/page/([0-9]+)", ComicPageAPIHandler ),
(self.webroot + r"/comic/([0-9]+)/thumbnail", ThumbnailAPIHandler),
(self.webroot + r"/comic/([0-9]+)/file", FileAPIHandler),
(self.webroot + r"/entities(/.*)*", EntityAPIHandler),
(self.webroot + r"/folders(/.*)*", FolderAPIHandler),
(self.webroot + r"/command", CommandAPIHandler),
(self.webroot + r"/scanstatus", ScanStatusAPIHandler),
#(r'/favicon.ico', tornado.web.StaticFileHandler, {'path': os.path.join(AppFolders.appBase(), "static","images")}),
(self.webroot + r'/.*', UnknownHandler),
]
settings = dict(
template_path=os.path.join(AppFolders.appBase(), "templates"),
static_path=os.path.join(AppFolders.appBase(), "static"),
static_url_prefix=self.webroot + "/static/",
debug=True,
#autoreload=False,
login_url=self.webroot + "/login",
cookie_secret=self.config['security']['cookie_secret'],
xsrf_cookies=True,
)
tornado.web.Application.__init__(self, handlers, **settings)
#.........这里部分代码省略.........