Esempio n. 1
0
    def processHostLine(date, year, talkTime, id, talk):
        cmd = commandParser.parseLine(talk)

        if commandParser.LECTURE == cmd[0]:
            if len(cmd) == 2:
                date = cmd[1] # .lecture @0304

            dateKey = '%d월 %d일' % ((date // 100), (date % 100))

            #print('making no %s table' % dateKey)
            dataList = []
            for row in userInfoTable:
                data = {'학번': row['no'], dateKey : 'O'} # default O --> attended
                dataList.append(data)

            #print(dataList)
            for data in dataList:
                attendanceTable.upsert(data, ['학번'])

            '''
            for row in attendanceTable:
                print(row)
            '''

        elif commandParser.REPORT == cmd[0]:
            if len(cmd) == 2: # .report 리포트
                reportName = cmd[1]
            elif len(cmd) == 3:
                date = cmd[1] # .report @0325 소스분석
                reportName = cmd[2]

            dateKey = '%d월 %d일' % ((date // 100), (date % 100))

            reportInfo = dict(date=dateKey, name=reportName)
            reportInfoTable.upsert(reportInfo, ['date'])


            dataList = []
            for row in userInfoTable:
                data = {'학번': row['no'], dateKey : '미제출'} # default X --> report not submitted
                dataList.append(data)

            for data in dataList:
                reportTable.upsert(data, ['학번'])

            '''
            for row in reportTable:
                print(row)
            '''

        elif commandParser.ABSENT == cmd[0]:
            if len(cmd) == 2: # .absent 이명박, 박근혜
                absentStudents = cmd[1]
            elif len(cmd) == 3:
                date = cmd[1] # .absent @0325 이명박, 박근혜
                absentStudents = cmd[2]

            dateKey = '%d월 %d일' % ((date // 100), (date % 100))
Esempio n. 2
0
def readKatalkUserInfo(fname):
    for line in common.feedLine(fname):
        print(line)
        result = katalkParser.parseLine(line)
        if 'TALK_LINE' == result[0]:
            #print(result)
            date, year, talkTime, katalkID, talk = result[1:]
            cmd = commandParser.parseLine(talk)
            if commandParser.USER == cmd[0]:
                yield katalkID, cmd[1], cmd[2] # .user 이대현, 89418022