예제 #1
0
파일: main.py 프로젝트: BobPyron/calibre
def main(args=sys.argv):
    from calibre.library.database2 import LibraryDatabase2
    parser = option_parser()
    opts, args = parser.parse_args(args)
    if opts.daemonize and not iswindows:
        daemonize()
    if opts.pidfile is not None:
        from cherrypy.process.plugins import PIDFile
        PIDFile(cherrypy.engine, opts.pidfile).subscribe()
    cherrypy.log.screen = True
    from calibre.utils.config import prefs
    if opts.with_library is None:
        opts.with_library = prefs['library_path']
    if not opts.with_library:
        print('No saved library path. Use the --with-library option'
                ' to specify the path to the library you want to use.')
        return 1
    db = LibraryDatabase2(opts.with_library)
    server = LibraryServer(db, opts, show_tracebacks=opts.develop)
    server.start()
    return 0
예제 #2
0
def main(args=sys.argv):
    from calibre.db import get_db_loader
    parser = option_parser()
    opts, args = parser.parse_args(args)
    if opts.daemonize and not iswindows:
        daemonize()
    if opts.pidfile is not None:
        from cherrypy.process.plugins import PIDFile
        PIDFile(cherrypy.engine, opts.pidfile).subscribe()
    cherrypy.log.screen = True
    from calibre.utils.config import prefs
    if opts.with_library is None:
        opts.with_library = prefs['library_path']
    if not opts.with_library:
        print('No saved library path. Use the --with-library option'
              ' to specify the path to the library you want to use.')
        return 1
    db = get_db_loader()[0](opts.with_library)
    server = LibraryServer(db, opts, show_tracebacks=opts.develop)
    server.start()
    return 0
예제 #3
0
파일: main.py 프로젝트: BobPyron/calibre
def start_threaded_server(db, opts):
    server = LibraryServer(db, opts, embedded=True, show_tracebacks=False)
    server.thread = Thread(target=server.start)
    server.thread.setDaemon(True)
    server.thread.start()
    return server
예제 #4
0
파일: main.py 프로젝트: pombreda/calibre-1
def start_threaded_server(db, opts):
    server = LibraryServer(db, opts, embedded=True, show_tracebacks=False)
    server.thread = Thread(target=server.start)
    server.thread.setDaemon(True)
    server.thread.start()
    return server