Skip to content

Latest commit

History

History
99 lines (76 loc) · 2.86 KB

README.md

File metadata and controls

99 lines (76 loc) · 2.86 KB

simfile - for Python 3

A modern simfile parsing & editing library for Python 3.

Full documentation can be found onRead the Docs.

Features

Installation

simfileis available on PyPI:

pip3 install simfile

Quickstart

Load simfiles from disk usingsimfile.openorsimfile.load:

>>>importsimfile
>>>springtime=simfile.open('testdata/Springtime/Springtime.ssc')
>>>springtime
<SSCSimfile:Springtime>
>>>withopen('testdata/nekonabe/nekonabe.sm','r')asinfile:
...nekonabe=simfile.load(infile)
...
>>>nekonabe
<SMSimfile:Miêu nồi>

Use lowercase attributes to access most common properties:

>>>springtime.artist
'Kommisar'
>>>springtime.banner
'springbn.png'
>>>springtime.subtitle='(edited)'
>>>springtime
<SSCSimfile:Springtime(edited)>

Alternatively, use uppercase strings to access the underlying dictionary:

>>>springtime['ARTIST']
'Kommisar'
>>>springtime['ARTIST']isspringtime.artist
True
>>>list(springtime.keys())[:7]
['VERSION','TITLE','SUBTITLE','ARTIST','TITLETRANSLIT','SUBTITLETRANSLIT','ARTISTTRANSLIT']

Charts are stored in a list under the.chartsattribute and function similarly to simfile objects:

>>>len(springtime.charts)
9
>>>chart=springtime.charts[0]
>>>chart
<SSCChart:dance-singleChallenge12>
>>>list(chart.keys())[:7]
['CHARTNAME','STEPSTYPE','DESCRIPTION','CHARTSTYLE','DIFFICULTY','METER','RADARVALUES']

Developing

simfileuses Pipenv for dependency management. Activate the environment:

pipenv shell

To run the unit tests:

py -m unittest

To build the documentation:

docs/make html