Metadata-Version: 2.1
Name: msdparser
Version: 2.0.0b5
Summary: Simple MSD parser (rhythm game format)
Home-page: http://github.com/garcia/msdparser
Author: Ash Garcia
Author-email: python-msdparser@garcia.sh
License: MIT
Keywords: stepmania simfile sm ssc dwi
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.6
Description-Content-Type: text/markdown

# 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

`msdparser` is available on PyPI. During the current 2.0 beta phase, make sure to pass `--pre` to `pip`:

```sh
pip install --pre msdparser
```

## Parsing

`parse_msd` takes a named `file` or `string` argument and yields `MSDParameter` instances:

```python
>>> from msdparser import parse_msd
>>> with open('testdata/Springtime.ssc', 'r', encoding='utf-8') as simfile:
...     for param in parse_msd(file=simfile):
...         if param.key == 'NOTEDATA': break   # stop at the first chart
...         if not param.value: continue        # hide empty values
...         print(param.key, '=', repr(param.value))
...
VERSION = '0.83'
TITLE = 'Springtime'
ARTIST = 'Kommisar'
BANNER = 'springbn.png'
BACKGROUND = 'spring.png'
MUSIC = 'Kommisar - Springtime.mp3'
OFFSET = '-0.090'
SAMPLESTART = '105.760'
SAMPLELENGTH = '15'
SELECTABLE = 'YES'
DISPLAYBPM = '182'
BPMS = '0=181.685'
TIMESIGNATURES = '0=4=4'
TICKCOUNTS = '0=2'
COMBOS = '0=1'
SPEEDS = '0=1=0=0'
SCROLLS = '0=1'
LABELS = '0=Song Start'
```

## Serializing

`MSDParameter` instances stringify back to MSD. They can be created from a sequence of strings:

```python
>>> from msdparser import MSDParameter
>>> pairs = [('TITLE', 'Springtime'), ('ARTIST', 'Kommisar')]
>>> for key, value in pairs:
...     print(str(MSDParameter(key=key, value=value)))
...
#TITLE:Springtime;
#ARTIST:Kommisar;
```

Prefer to use `MSDParameter` over interpolating the key/value pairs between `#:;` characters yourself. The `str()` implementation inserts escape sequences where required, preventing generation of invalid MSD.

## Documentation

https://msdparser.readthedocs.io/en/latest/


