Skip to main content

Simple MSD parser (rhythm game format)

Project description

msdparser

Simple MSD parser for Python. MSD is the underlying file format for many rhythm games, most notably both StepMania simfile formats (.sm and .ssc).

Installing

pip install msdparser

Usage

MSDParser takes a named file or string argument. It supports context management and iteration. Parameters are yielded as (key, value) pairs of strings.

from msdparser import MSDParser

with open('simfile.sm', 'r', encoding='utf-8') as simfile:
    with MSDParser(file=simfile) as parser:
        for (key, value) in parser:
            if key == 'NOTES':
                break
            print(key, '=', repr(value))

The MSD format

In general, MSD key-value pairs look like #KEY:VALUE; - the # starts a parameter, the first : separates the key from the value, and the ; terminates the value. Keys are not expected to be unique. There are no escape sequences.

Comments start with // and persist until the end of the line.

Keys can contain any text except for :, //, and a newline followed by a # (see below). Values are the same, except : is allowed.

Keys and values can be blank. The : separator can even be omitted, which has the same result as a blank value.

StepMania recovers from a missing ; if it finds a # marker at the start of a line, so MSDParser does too.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msdparser-0.1.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

msdparser-0.1.1-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page