def ft_channels_off():
    #print(yate.start_response())
    obj = deal_mysql()
    form_data = cgi.FieldStorage()    
    chidlist = form_data.getvalue('which_channel') 
    '''
    #if  users checked one option the chidlist is a number,
    else if users checked more then one options, chidlist will be a list instance
    '''
    if isinstance(chidlist,list):
        for item in chidlist:
            msg1 = """delete from ulv_opchannels where chid=%s""" % int(item)
            #print(msg1)
            obj.updateDb(msg1)
            
            msg2 = """delete from ulv_genchannels where channel_id=%s""" % int(item)
            obj.updateDb(msg2)
            
            msg3 = """update tvs_channel set status=0 where chid=%s """ % int(item)
            obj.updateDb(msg3)
    else:
        msg1 = """delete from ulv_opchannels where chid=%s""" % int(chidlist)
        #print(msg1)
        obj.updateDb(msg1)
        
        msg2 = """delete from ulv_genchannels where channel_id=%s""" % int(chidlist)
        obj.updateDb(msg2)
        
        msg3 = """update tvs_channel set status=0 where chid=%s """ % int(chidlist)
        obj.updateDb(msg3)        
    obj.Close()
    channels_offline(True)
def channelop():
    respData = get_formData('channel_id','sort_id')
    obj = deal_mysql()
    msg=('''insert into ulv_genchannels (channel_id,sort_id) 
    select %s,%s from DUAL 
    WHERE  not exists (SELECT channel_id,sort_id from ulv_genchannels WHERE channel_id=%s and sort_id=%s)''' 
         % (respData[0],respData[1],respData[0],respData[1]))
    obj.updateDb(msg)
    msgn = """UPDATE tvs_channel set `status`=1 where chid=%s""" % respData[0]
    obj.updateDb(msgn)
    obj.Close()
    printChannels.channels_offline(False)    
Esempio n. 3
0
#!/usr/bin/env python
#coding=utf-8
import printChannels

printChannels.channels_offline(True)

Esempio n. 4
0
#!/usr/bin/env python
#coding=utf-8

import printChannels

printChannels.channels_offline(False)