def get_video_category(self): video_cates = self.get_video_category_ex() # 得到每个分类的最新的 6 张视频 qry = VideoQuery( " v.videoId, v.title, v.href,u.loginName,v.flvThumbNailHref") for c in video_cates: qry.sysCateTitle = c["categoryName"] c["video_list"] = qry.query_map(5) #如果没有分类,则显示当前的全部图片 if len(video_cates) == 0: video_cates = None pager = self.params.createPager() pager.itemName = u"视频" pager.itemUnit = u"个" pager.pageSize = 24 qry = VideoQuery( " v.videoId, v.title, v.createDate, v.href, v.userId, u.loginName, v.flvThumbNailHref " ) qry.orderType = 0 pager.totalRows = qry.count() video_list_all = qry.query_map(pager) request.setAttribute("video_list_all", video_list_all) request.setAttribute("pager", pager) request.setAttribute("video_cates", video_cates)
def get_video_with_pager(self): pager = self.params.createPager() pager.itemName = u"视频" pager.itemUnit = u"个" pager.pageSize = 24 qry = VideoQuery( """ v.videoId, v.title, v.createDate, v.href, v.userId, u.loginName, u.nickName, v.summary,v.flvThumbNailHref """ ) if ((self.categoryName != None) and (self.categoryName != "")): qry.sysCateTitle = self.categoryName if self.type == "new": qry.orderType = 1 elif self.type == "hot": qry.orderType = 2 else: qry.orderType = 0 pager.totalRows = qry.count() video_list = qry.query_map(pager) request.setAttribute("video_list", video_list) request.setAttribute("pager", pager)