Esempio n. 1
0
def modify_sfxfile(fout, filename, on_wav_file):
    with rfactortools.open_read(filename) as fin:
        lines = fin.read().splitlines()

    for orig_line in lines:
        m = comment_regex.match(orig_line)
        if m:
            comment = m.group(2)
            line = m.group(1)
        else:
            comment = ""
            line = orig_line

        suffix = comment

        m = wav1_regex.match(line)
        if m:
            wav = on_wav_file(rfactortools.nt2posixpath(m.group(3)))
            if wav is not None:
                wav = ntpath.normpath(wav)
            else:
                wav = m.group(3)
            fout.write("%s=%s,%s%s\n" % (m.group(1), m.group(2), wav, suffix))
        else:
            m = wav2_regex.match(line)
            if m:
                wav = on_wav_file(rfactortools.nt2posixpath(m.group(2)))
                if wav is not None:
                    wav = ntpath.normpath(wav)
                else:
                    wav = m.group(2)
                fout.write("%s=%s%s\n" % (m.group(1), wav, suffix))
            else:
                fout.write(orig_line)
                fout.write("\n")
Esempio n. 2
0
def modify_sfxfile(fout, filename, on_wav_file):
    with rfactortools.open_read(filename) as fin:
        lines = fin.read().splitlines()

    for orig_line in lines:
        m = comment_regex.match(orig_line)
        if m:
            comment = m.group(2)
            line = m.group(1)
        else:
            comment = ""
            line = orig_line

        suffix = comment

        m = wav1_regex.match(line)
        if m:
            wav = on_wav_file(rfactortools.nt2posixpath(m.group(3)))
            if wav is not None:
                wav = ntpath.normpath(wav)
            else:
                wav = m.group(3)
            fout.write("%s=%s,%s%s\n" % (m.group(1), m.group(2), wav, suffix))
        else:
            m = wav2_regex.match(line)
            if m:
                wav = on_wav_file(rfactortools.nt2posixpath(m.group(2)))
                if wav is not None:
                    wav = ntpath.normpath(wav)
                else:
                    wav = m.group(2)
                fout.write("%s=%s%s\n" % (m.group(1), wav, suffix))
            else:
                fout.write(orig_line)
                fout.write("\n")
Esempio n. 3
0
def parse_vehfile(filename):
    veh = Veh()

    veh.filename = filename

    with rfactortools.open_read(filename) as fin:
        for orig_line in fin.read().splitlines():
            line = orig_line

            m = comment_regex.match(line)
            if m:
                # comment = m.group(2)
                line = m.group(1)

            m = keyvalue_regex.match(line)
            if m:
                key, value = m.group(1), m.group(2)
                if key.lower() == "graphics":
                    veh.graphics_file = rfactortools.nt2posixpath(value.strip())
                elif key.lower() == "spinner":
                    veh.spinner_file = rfactortools.nt2posixpath(value.strip())
                elif key.lower() == "classes":
                    veh.classes = [c.strip() for c in unquote(value).split(",")]
                elif key.lower() == "category":
                    veh.category = [c.strip() for c in unquote(value).split(",")]
                elif key.lower() == "driver":
                    veh.driver = unquote(value)
                elif key.lower() == "team":
                    veh.team = unquote(value)
                else:
                    pass

    return veh
Esempio n. 4
0
def parse_sfxfile(filename):
    sfx = SFX()

    with rfactortools.open_read(filename) as fin:
        for orig_line in fin.read().splitlines():
            m = comment_regex.match(orig_line)
            if m:
                # comment = m.group(2)
                line = m.group(1)
            else:
                # comment = None
                line = orig_line

            m = wav1_regex.match(line)
            if m:
                sfx.wavs.append(rfactortools.nt2posixpath(m.group(3)))
            else:
                m = wav2_regex.match(line)
                if m:
                    sfx.wavs.append(rfactortools.nt2posixpath(m.group(2)))
    return sfx
Esempio n. 5
0
def parse_sfxfile(filename):
    sfx = SFX()

    with rfactortools.open_read(filename) as fin:
        for orig_line in fin.read().splitlines():
            m = comment_regex.match(orig_line)
            if m:
                # comment = m.group(2)
                line = m.group(1)
            else:
                # comment = None
                line = orig_line

            m = wav1_regex.match(line)
            if m:
                sfx.wavs.append(rfactortools.nt2posixpath(m.group(3)))
            else:
                m = wav2_regex.match(line)
                if m:
                    sfx.wavs.append(rfactortools.nt2posixpath(m.group(2)))
    return sfx