Ejemplo n.º 1
0
    def __init__(self, conf, debug=False):
        handlers = [
            ('/', IndexHandler),
            ('/admin/drama/add', AdminDramaAddHandler),
            ('/admin/drama/list', AdminDramaListHandler),
            ('/admin/drama/search', AdminDramaSearchHandler),
            ('/admin/drama/parser', AdminDramaParserHandler),
            ('/api/drama/list', ApiDramaListHandler),
            ('/api/drama/search', ApiDramaSearchHandler),
            ('/drama/episode/play/(\S+)', DramaEpisodePlayHandler),
            ('/drama/episode/(\S+)', DramaEpisodeHandler),
            ('/weixin', WeixinHandler),
        ]
        settings = dict(template_path=os.path.join(os.path.dirname(__file__),
                                                   "./web/template"),
                        static_path=os.path.join(os.path.dirname(__file__),
                                                 "./web/static"),
                        debug=debug,
                        autoescape=None)
        self.conf = conf
        engine = MysqlEngine(conf.get('db.uri'))

        BaseModel.setup_all_model(engine)

        self.dramaModel = DramaModel.instance()
        self.episodeModel = DramaEpisodeModel.instance()

        self.dramaService = DramaService()
        self.wechat = WechatBasic(token=conf.get("wechat.token"),
                                  appid=conf.get("wechat.appId"),
                                  appsecret=conf.get("wechat.appSecret"))
        self.hashid = Hashids(salt="woshifyz")
        self.parser = {'tudou': TudouParser()}
        super(Application, self).__init__(handlers, **settings)
Ejemplo n.º 2
0
 def __init__(self):
     self.tudouParser = TudouParser()
     self.model = DramaEpisodeModel()
     self.urlModel = UrlContentModel()