コード例 #1
0
def parseEditor(line):
    editors = []
    if line == None:
        return editors
    r = re.compile(Regex['EDITOR'])
    m = r.findall(line)
    for name in m:
        p = Person()
        p.name = name.strip()
        editors.append(p)
    return editors
コード例 #2
0
def parseComposer(line):
    if line == None:
        return []
    authors = []
    for composer in line.split(';'):
        composer = composer.strip()
        person = Person()
        r = re.compile(Regex['COMPOSER'])
        m = r.match(composer)
        if m:
            person.name = m.group(1)
            if m.group(2) and isInt(m.group(2)):
                person.born = int(m.group(2))
            if m.group(4) and isInt(m.group(4)):
                if m.group(3) == '*':
                    person.born = int(m.group(4))
                else:
                    person.died = int(m.group(4))
        else:
            person.name = composer
        authors.append(person)
    return authors