Exemplo n.º 1
0
def load_goplayalong(filename):
    gpa = xml2json(open(filename).read())

    sync = [y.split(';') for y in gpa.sync.split('#')[1:]]
    sync = {float(b) + float(db): float(t) / 1000.0 for t, b, db, _ in sync}
    sync = Bar2Time(sync, -10.0)

    d = os.path.dirname(os.path.abspath(filename))
    gpx = load_gpx(d + os.path.sep + gpa.scoreUrl)

    return gpx, gpa.mp3Url, sync
Exemplo n.º 2
0
def load_goplayalong(filename):
    gpa = xml2json(open(filename).read())

    sync = [y.split(';') for y in gpa.sync.split('#')[1:]]
    sync = {float(b) + float(db): float(t) / 1000.0 for t, b, db, _ in sync}
    sync = Bar2Time(sync, -10.0)

    d = os.path.dirname(os.path.abspath(filename))
    gpx = load_gpx(d + os.path.sep + gpa.scoreUrl)

    return gpx, gpa.mp3Url, sync
Exemplo n.º 3
0
def load_gpx(filename):
    def process(x):
        """Transform attributes such as '1 2 3' in [1, 2, 3]"""
        y = DefaultConverter(x)
        if y == x:
            t = x.split(' ')
            if len(t) > 0 and t[0] != DefaultConverter(t[0]):
                return map(DefaultConverter, t)
        return y

    gp = xml2json(read_gp(filename), processor=process)

    # squashing arrays for convience
    for k in ['Track', 'MasterBar', 'Bar', 'Voice', 'Beat', 'Note', 'Rhythm']:
        gp[k + 's'] = gp[k + 's'][k]

    return gp
Exemplo n.º 4
0
def load_gpx(filename):
    def process(x):
        """Transform attributes such as '1 2 3' in [1, 2, 3]"""
        y = DefaultConverter(x)
        if y == x:
            t = x.split(' ')
            if len(t) > 0 and t[0] != DefaultConverter(t[0]):
                return map(DefaultConverter, t)
        return y

    gp = xml2json(read_gp(filename), processor=process)

    # squashing arrays for convience
    for k in ['Track', 'MasterBar', 'Bar', 'Voice', 'Beat', 'Note', 'Rhythm']:
        gp[k + 's'] = gp[k + 's'][k]

    return gp
Exemplo n.º 5
0
def compile_xml(text):
    sng = xml2json(text, notag=True)
    process_sng(sng)
    urn, manifest = build_manifest(sng)
    return urn, manifest_header(manifest), sngparser.SONG.build(sng)