Exemple #1
0
def handleStandings(wikicode):
    ranks = wikicode.filter(True, r'\|\d+', forcetype=Text)
    linkifiedNames = wikicode.filter_wikilinks()
    flagRace = wikicode.filter(True, r'flagRace', forcetype=Template)
    points = wikicode.filter(True, r"'''", forcetype=Tag)
    for i in range(0, len(flagRace)):
        standing = DBEntry()
        standing.rank = int((ranks[i][1 + ranks[i].rfind('\n'):].replace('|','')).strip())
        standing.name = unicode(linkifiedNames[i + 2].title)
        standing.flag = unicode(flagRace[i].params[0].value)
        standing.race = unicode(flagRace[i].params[1].value)
        standing.points = int(unicode(points[i].contents))
        standings.append(standing)
        i += 1
Exemple #2
0
def handleGroupEntry(entry):
    newParticipant = DBEntry()
    for param in entry.params:
        for template in param.value.filter_templates():
            if unicode(template.name) == 'player':
                newParticipant.name = getStr(template, '1')
                newParticipant.flag = getStr(template, 'flag')
                newParticipant.race = getStr(template, 'race')
    newParticipant.place = getInt(entry, 'place')
    newParticipant.matcheswon = getInt(entry, 'win_m')
    newParticipant.matcheslost = getInt(entry, 'lose_m')
    newParticipant.mapswon = getInt(entry, 'win_g')
    newParticipant.mapslost = getInt(entry, 'lose_g')
    newParticipant.result = getStr(entry, 'bg')
    newParticipant.scheduleid = lastSchedule.id
    participants.append(newParticipant)