def channels_offline(channel_offline=True): message = ("""SELECT ulv_genchannels.channel_id, tvs_channel.chname, ulv_genaddress.gen_address, ulv_status.des FROM ulv_genchannels NATURAL JOIN tvs_channel, ulv_genaddress, ulv_status WHERE ulv_genchannels.channel_id = tvs_channel.chid AND tvs_channel.chid = ulv_genaddress.channel_id AND ulv_status.status_id=1 order by ulv_genchannels.sort_id, ulv_genchannels.channel_id""") conn = my_sql.connect() cursor = conn.cursor() cursor.execute(message) result = cursor.fetchall() conn.close() headers = ["频道名称", "频道编号", "直播路径", "发布状态"] print(yate.start_response()) if channel_offline: print(yate.include_header("频道下线")) else: print(yate.include_header("已发布频道")) print(yate.start_form("ft_channels_offline.py")) print(yate.start_table(tb_width="100%", tb_border="1px solid")) print(yate.tb_header(headers)) for array in result: print(yate.do_table(array, channel_offline)) print(yate.end_table()) if channel_offline==True: print(yate.end_form("确定"))
info1 = """from tvs_channel,live_channel,live_server,live_url,live_status where tvs_channel.chid=live_channel.chid and """ info2 = """live_status.statusid=live_channel.statusid and live_url.live_urlid=live_channel.live_urlid and live_url.serverid = live_server.serverid """ info3 = """and live_url.status=0 order by live_channel.chid ASC""" message = info + info1 + info2+info3 #print message #newms = """select live_channel.chid,tvs_channel.chname,live_status.sname,live_url.live_path from tvs_channel,live_channel,live_status,live_url """ #newms = newms + """where tvs_channel.chid=live_channel.chid and live_status.statusid=live_channel.statusid and """ #newms = newms + """live_channel.live_urlid is null and live_url.chid=live_channel.chid order by live_channel.chid """ #print newms conn = mysql.connect() cursor = conn.cursor() cursor.execute(message) result = cursor.fetchall() #print result #cursor.execute(newms) #nres = cursor.fetchall() #print 'nres',nres conn.close() #print dics print(yate.do_table_head()) for array in result: #print array[0] print(yate.do_table(array[0],array[1].decode('utf-8'),array[2],array[3],array[4].encode('utf-8'))) #for array in nres: #print(yate.do_table(array[0],array[1].decode('utf-8'),' ',array[3],array[2].encode('utf-8'))) print(yate.do_table_end("edit.py",u'删除'.encode('utf-8'),u'修改'.encode('utf-8')))
form_data = cgi.FieldStorage() if 'position' in form_data: position = form_data['position'] results = get_results(sql) if results: for each in results: apname = each[0] pircurl= each[1] loadurl= each[2] types = each[3] position = each[4] print(yate.do_table_head()) print(yate.sub_table(apname,pircurl,loadurl,types)) print(yate.do_table_end('indexedit.py')) if 'apname' in form_data and 'picurl'in form_data and 'loadurl' in form_data and types in form_data and position in form_data: apname = form_data['apname'] pircurl= form_data['picurl'] loadurl= form_data['loadurl'] types = form_data['types'] position = form_data['position'] print(yate.do_table_head()) print(yate.do_table(key, cn, si, sp, ss)) print(yate.do_table_end(myapp)) print('update success!!!')
if not sig and cid: cursor.execute(message) conn.commit() conn.close() #select form order_list and show in tables dics = {} info = """select live_channel.chid,tvs_channel.chname,live_server.live_ip,live_server.storage_addr,live_status.sname """ info1 = """from tvs_channel,live_channel,live_server,live_status where tvs_channel.chid=live_channel.chid and """ info2 = """live_status.status=live_channel.statusid and live_server.chid=live_channel.chid order by tvs_channel.chid ASC """ message = info + info1 + info2 #print message conn = mysql.connect() cursor = conn.cursor() cursor.execute(message) result = cursor.fetchall() conn.close() #print dics print(yate.start_form('edit.py')) print(yate.do_table_head()) for array in result: #print array[0] print(yate.do_table(array[0],array[1],array[2],array[3],array[4])) print(yate.do_table_end())