コード例 #1
0
ファイル: video.py プロジェクト: reasonz/projects
def getitems():
    page = request.query.get('page',1)
    vid = request.query.get('id')
    vtitle = request.query.get('title')
    vproduct = request.query.get('product')
    vcp = request.query.get('cp')
    vstart=request.query.get('start')
    vend=request.query.get('end')
    page = int(page)
    start = (page-1)*pagesize
    end = (page)*pagesize
    print start,end
    channellist=getallchannel()

   
    conn=db.getmysqlconn()
    c= conn.cursor()
    qs = " 1=1"
    querylist= []
    query_args={"title":'',"id":'',"start":'',"end":''}
    if vid and len(vid)>0:
        qs += " and  itemid='"+vid + "'"
        query_args['itemid']=vid
        
    if vtitle and len(vtitle)>0:
        qs += " and title='"+ vtitle + "'"
        query_args['title']=vtitle
        
    if vstart and vend and len(vstart)>0 and len(vend)>0:
        qs += " and addtime >='"+vstart + "' and addtime <='" + vend +"'"
        query_args['start']=vstart
        query_args['end']=vend

    sql = "select * from gkgp_item where "+qs+" limit %s,%s"
    c.execute(sql,(start,pagesize)) 

    l=[]
    for one in c.fetchall():
        l.append(one)
    print len(l)
    sqlcount = "select count(*) from gkgp_item where " + qs
    c.execute(sqlcount)
    totalrecord = c.fetchone()[0]
    c.close()
    conn.close()
    totalpage=0
    if totalrecord/pagesize <1:
        totalpage=1
    else:
        if totalrecord % pagesize ==0:
            totalpage=totalrecord/pagesize
        else:
            totalpage = totalrecord/pagesize + 1
    return dict(all=l,total=totalpage,domain=SITE_DOMAIN,startpage=page,channellist=channellist,query_args=query_args,play_domain=PLAY_VIDEO_DOMAIN)
コード例 #2
0
ファイル: video.py プロジェクト: reasonz/projects
def getitems():
    page = request.query.get('page',1)
    vid = request.query.get('id')
    vtitle = request.query.get('title')
    vproduct = request.query.get('product')
    vcp = request.query.get('cp')
    vstart=request.query.get('start')
    vend=request.query.get('end')
    page = int(page)
    start = (page-1)*pagesize
    end = (page)*pagesize
    print start,end
    channellist=getallchannel()

    conn=db.getmysqlconn()
    c= conn.cursor()
    qs = ""
    querylist= []
    # if vid :
    #     qs += ' contentid=%s'
    #     querylist.append(vid)
    # if vtitle :
    #     qs += ' namecn=%s'
    #     querylist.append(vtitle)
    # if 

    sql = "select id,namecn,cpid,createtime,still from HNSJ_TDCMS_ITEM limit %s,%s"
    c.execute(sql,(start,pagesize))
    l=[]
    for one in c.fetchall():
        l.append(one)
    print len(l)
    sqlcount = "select count(*) from HNSJ_TDCMS_ITEM"
    c.execute(sqlcount)
    totalrecord = c.fetchone()[0]
    c.close()
    conn.close()
    totalpage=0
    if totalrecord/pagesize <1:
        totalpage=1
    else:
        totalpage=totalrecord/pagesize

    return dict(all=l,total=totalpage,domain=SITE_DOMAIN,startpage=page,channellist=channellist)
コード例 #3
0
ファイル: channel.py プロジェクト: reasonz/projects
def getitems():
    channellist=getallchannel()
    menulist = getallmenu()
    return dict(domain=SITE_DOMAIN,channellist=channellist,channel_type_dict=channel_type_dict,menulist=menulist)