Esempio n. 1
0
 def index_search(tv_name):
     """
     首页搜素功能
     :param tv_name: 搜索关键字
     :return:
     """
     return Mongo.find('t_tv', {'tv_name': re.compile(tv_name)})
Esempio n. 2
0
 def like_hot(tv_type_item):
     """
     相关热播,就是同小类型的视频的最新更新的前20个中随机抽取6个
     :param tv_type_item: 视频的小类
     :return:
     """
     return Mongo.find('t_tv', {'tv_type': tv_type_item}, skip=0, limit=20)
Esempio n. 3
0
 def index_tops(tv_type):
     """
     查询首页热门推荐数据,数据来源百度风云榜
     :param tv_type: 视频类型 mv,dm,zy,dsj
     :return:
     """
     result = []
     tops = Mongo.find('t_tv_banner_top', {'tv_type': tv_type})
     if tops and len(tops) > 0:
         for t in tops:
             tn = str(t['tv_name']).strip()
             tvs = Mongo.find('t_tv', {'tv_name': re.compile(tn)})
             if tvs and len(tvs) > 0:
                 result.append({
                     "tv_vo": tvs[0],
                     "tv_img": str(t['tv_img'])
                 })
     return result
Esempio n. 4
0
 def index_tv_more(tv_type):
     """
     首页每项视频的更多功能
     :param tv_type: 视频的大类
     :return:
     """
     result = {}
     tv_type = Config.TV_KV_LIST.get(tv_type) if tv_type else None
     for tty in tv_type:
         result[tty] = Mongo.find('t_tv', {'tv_type': tty},
                                  skip=0,
                                  limit=12)
     result['tv_news'] = Mongo.find('t_tv', {'tv_type': {
         '$in': tv_type
     }},
                                    skip=0,
                                    limit=12)
     return result
Esempio n. 5
0
 def tv_detail(tv_id):
     """
     查询tv详情
     :param tv_id: 视频的id
     :return:
     """
     detail = Mongo.find_one('t_tv', {'tv_id': tv_id})
     if detail:
         urls = Mongo.find('t_tv_urls', {'tv_id': tv_id})
         urls = [(su['tv_source'], su['tv_url']) for su in urls]
         detail['urls'] = urls
     return detail
Esempio n. 6
0
 def index_mvs(tv_type):
     """
     首页各种类视频
     :param tv_type: 视频类型 mv,dm,zy,dsj
     :return:
     """
     tv_type = Config.TV_KV_LIST.get(tv_type) if tv_type else None
     return Mongo.find('t_tv', {'tv_type': {
         '$in': tuple(tv_type)
     }},
                       skip=0,
                       limit=8)
Esempio n. 7
0
 def index_news():
     """
     首页最新视频
     :return:
     """
     return Mongo.find('t_tv', {}, skip=0, limit=12)
Esempio n. 8
0
 def query_friend_urls():
     """
     首页友情链接
     :return:
     """
     return Mongo.find('t_f_u', {'del_flag': '0'})