Esempio n. 1
0
class Application(web.Application):
    def __init__(self):
        from handlers import handlers, ui_modules
        from libs.util import ui_methods
        from libs.db_task_manager import DBTaskManager
        from libs.user_manager import UserManager
        settings = dict(
            debug=options.debug,
            template_path=os.path.join(os.path.dirname(__file__), "templates"),
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            cookie_secret=options.cookie_secret,
            login_url="/login",

            ui_modules=ui_modules,
            ui_methods=ui_methods,
        )
        super(Application, self).__init__(handlers, **settings)

        self.user_manager = UserManager()
        self.task_manager = DBTaskManager(
                    username = options.username,
                    password = options.password
                )
        if not self.task_manager.islogin:
            raise Exception, "xunlei login error"
        self.task_manager.update()
        PeriodicCallback(self.task_manager.async_update,
                options.downloading_task_check_interval * 1000).start()

        logging.info("load finished!")
Esempio n. 2
0
    def __init__(self):
        from handlers import handlers, ui_modules
        from libs.util import ui_methods
        from libs.db_task_manager import DBTaskManager
        from libs.user_manager import UserManager
        settings = dict(
            debug=options.debug,
            template_path=os.path.join(os.path.dirname(__file__), "templates"),
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            cookie_secret=options.cookie_secret,
            login_url="/login",

            ui_modules=ui_modules,
            ui_methods=ui_methods,
        )
        super(Application, self).__init__(handlers, **settings)

        self.user_manager = UserManager()
        self.task_manager = DBTaskManager(
                    username = options.username,
                    password = options.password
                )
        if not self.task_manager.islogin:
            raise Exception, "xunlei login error"
        self.task_manager.async_update()
        PeriodicCallback(self.task_manager.async_update,
                options.downloading_task_check_interval * 1000).start()

        logging.info("load finished!")
Esempio n. 3
0
    def __init__(self):
        from handlers import handlers, ui_modules
        from libs.util import ui_methods
        from libs.db_task_manager import DBTaskManager
        from libs.user_manager import UserManager
        from libs.vip_pool import VIPool
        settings = dict(debug=options.debug,
                        template_path=path % "templates",
                        static_path=path % "static",
                        cookie_secret=options.cookie_secret,
                        login_url="/login",
                        autoreload=True,
                        compiled_template_cache=False,
                        gzip=True,
                        serve_traceback=False,
                        ui_modules=ui_modules,
                        ui_methods=ui_methods)
        super(Application, self).__init__(handlers, **settings)

        self.user_manager = UserManager()
        self.task_manager = DBTaskManager(username=options.username,
                                          password=options.password)
        self.vip_pool = VIPool()
        if not self.task_manager.islogin:
            raise Exception, "xunlei login error"
        self.task_manager.async_update()
        PeriodicCallback(self.task_manager.async_update,
                         options.downloading_task_check_interval *
                         1000).start()
        PeriodicCallback(self.user_manager.reset_all_add_task_limit,
                         86400 * 1000).start()

        logging.info("load finished! listening on %s:%s" %
                     (options.bind_ip, options.port))
Esempio n. 4
0
    def __init__(self):
        from handlers import handlers, ui_modules
        from libs.util import ui_methods
        from libs.db_task_manager import DBTaskManager
        from libs.user_manager import UserManager
        from libs.vip_pool import VIPool
        settings = dict(
            debug=options.debug,
            template_path=path % "templates",
            static_path=path % "static",
            cookie_secret=options.cookie_secret,
            login_url="/login",
            autoreload=True,
            compiled_template_cache=False,
            gzip=True,
            serve_traceback=False,
            ui_modules=ui_modules,
            ui_methods=ui_methods
        )
        super(Application, self).__init__(handlers, **settings)

        self.user_manager = UserManager()
        self.task_manager = DBTaskManager(
                    username = options.username,
                    password = options.password
                )
        self.vip_pool = VIPool()
        if not self.task_manager.islogin:
            raise Exception, "xunlei login error"
        self.task_manager.async_update()
        PeriodicCallback(self.task_manager.async_update,
                options.downloading_task_check_interval * 1000).start()
        PeriodicCallback(self.user_manager.reset_all_add_task_limit, 86400 * 1000).start()

        logging.info("load finished! listening on %s:%s" % (options.bind_ip, options.port))
Esempio n. 5
0
class Application(web.Application):
    def __init__(self):
        from handlers import handlers, ui_modules
        from libs.util import ui_methods
        from libs.db_task_manager import DBTaskManager
        from libs.user_manager import UserManager
        from libs.vip_pool import VIPool
        settings = dict(
            debug=options.debug,
            template_path=os.path.join(os.path.dirname(__file__), "templates"),
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            cookie_secret=options.cookie_secret,
            login_url="/login",
            google_oauth={
                "key": options.google_oauth_key,
                "secret": options.google_oauth_secret,
                },

            ui_modules=ui_modules,
            ui_methods=ui_methods,
        )
        super(Application, self).__init__(handlers, **settings)

        self.user_manager = UserManager()
        self.task_manager = DBTaskManager(
                    username = options.username,
                    password = options.password
                )
        self.vip_pool = VIPool()
        if not self.task_manager.islogin:
            raise Exception, "xunlei login error"
        self.task_manager.async_update()
        PeriodicCallback(self.task_manager.async_update,
                options.downloading_task_check_interval * 1000).start()
        PeriodicCallback(self.user_manager.reset_all_add_task_limit, 86400 * 1000).start()

        logging.info("load finished! listening on %s:%s" % (options.bind_ip, options.port))