7 from bottle import thread # portable import
9 from m_librarian.db import open_db
10 import m_librarian.web.app # noqa: F401 imported but unused
11 from m_librarian.web.server import run_server
12 from m_librarian.web.utils import get_open_port
15 def start_browser(port):
16 time.sleep(1) # A small timeout to allow the main thread to run the server
17 webbrowser.open_new('http://localhost:%d/' % port)
20 if __name__ == '__main__':
21 parser = argparse.ArgumentParser(description='Init')
22 parser.add_argument('-p', '--port', help='HTTP server port')
23 args = parser.parse_args()
28 port = get_open_port()
31 thread.start_new_thread(start_browser, (port,))