Beispiel #1
0
    data = s.recv(1024)
    # print 'login req data 2: ', data
    s.close()
    gid = douyu_tools.getGidFromMainServer(data)
    print 'gid: ', gid


    s = douyu_tools.connectDanmuServer(8602, room_id)
    data = s.recv(1024)
    print 'data: ',data

    s = douyu_tools.joinDanmuRoom(s, room_id, gid)

    while True:
        data = s.recv(1024)
        data_list = douyu_tools.getDataList(data)
        for data in data_list:
        	danmu_type = douyu_tools.getDanmuType(data)
        	if danmu_type == douyu_tools.TYPE_DANMU:
        	    snick, content = douyu_tools.getDanmuDetails(data)
        	    print snick, ': ', content
        	elif danmu_type == douyu_tools.TYPE_YUWAN:
        	    snick, hits = douyu_tools.getYuwanDetails(data)
        	    print snick, '赠送了100鱼丸', hits,'连击'
        	elif danmu_type == douyu_tools.TYPE_DONA_YUWAN:
         	    snick, hc = douyu_tools.getDonaYuwanDetails(data)
        	    print snick, '赠送了100鱼丸', hc,'连击' 
        	else:
        	    print 'Error: ', data
    s.close
Beispiel #2
0
 data_list = douyu_tools.getDataList(data)
 # print 'len(data_list): ', len(data_list)
 for data in data_list:
     danmu_type, = douyu_tools.getDanmuType(data)
     print '--------type: ', danmu_type
     if danmu_type == douyu_tools.TYPE_DANMU:
         print '[DANMU]data: ', data
         content, snick = douyu_tools.getDanmuDetails(data)
         print snick, ': ', content
     elif danmu_type == douyu_tools.TYPE_YUWAN:
         print '[YUWAN]data: ', data
         hits, snick = douyu_tools.getYuwanDetails(data)
         print snick, '赠送了100鱼丸', hits, '连击'
     elif danmu_type == douyu_tools.TYPE_DONA_YUWAN:
         print '[YUWAN DONA]data: ', data
         hc, snick = douyu_tools.getDonaYuwanDetails(data)
         print snick, '赠送了100鱼丸', hc, '连击'
     elif danmu_type == douyu_tools.TYPE_USER_ENTER:
         print '[USER_ENTER]data: ', data
         snick, deserve_lev, scq_cnt = douyu_tools.getUserEnterDetails(
             data)
         print 'LV', deserve_lev, ' * ', scq_cnt, ' ', snick, '来到本房间'
     elif danmu_type == douyu_tools.TYPE_ONLINE_GIFT:
         print '[ONLINE_GIFT]data: ', data
         sil, nn = douyu_tools.getOnlineGiftDetails(data)
         print nn, '领取了', sil, '个鱼丸'
     elif danmu_type == douyu_tools.TYPE_BLACK_RES:
         print '[BLACK_RES]data: ', data
         dnick, = douyu_tools.getBlackResDetails(data)
         print dnick, '被禁言'
     elif danmu_type == douyu_tools.TYPE_BUY_DESERVE:
Beispiel #3
0
 data_list = douyu_tools.getDataList(data)
 # print 'len(data_list): ', len(data_list)
 for data in data_list:
     danmu_type, = douyu_tools.getDanmuType(data)
     print '--------type: ', danmu_type
     if danmu_type == douyu_tools.TYPE_DANMU:
         print '[DANMU]data: ', data
         content, snick = douyu_tools.getDanmuDetails(data)
         print snick, ': ', content
     elif danmu_type == douyu_tools.TYPE_YUWAN:
         print '[YUWAN]data: ', data
         hits, snick = douyu_tools.getYuwanDetails(data)
         print snick, '赠送了100鱼丸', hits, '连击'
     elif danmu_type == douyu_tools.TYPE_DONA_YUWAN:
         print '[YUWAN DONA]data: ', data
         hc, snick = douyu_tools.getDonaYuwanDetails(data)
         print snick, '赠送了100鱼丸', hc, '连击'
     elif danmu_type == douyu_tools.TYPE_USER_ENTER:
         print '[USER_ENTER]data: ', data
         snick, deserve_lev, scq_cnt = douyu_tools.getUserEnterDetails(data)
         print 'LV', deserve_lev, ' * ', scq_cnt, ' ', snick, '来到本房间'
     elif danmu_type == douyu_tools.TYPE_ONLINE_GIFT:
         print '[ONLINE_GIFT]data: ', data
         sil, nn = douyu_tools.getOnlineGiftDetails(data)
         print nn, '领取了', sil, '个鱼丸'
     elif danmu_type == douyu_tools.TYPE_BLACK_RES:
         print '[BLACK_RES]data: ', data
         dnick, = douyu_tools.getBlackResDetails(data)
         print dnick, '被禁言'
     elif danmu_type == douyu_tools.TYPE_BUY_DESERVE:
         print '[BUY_DESERVE]data: ', data, ' type: ', danmu_type