Modern simfile library for Python
Project description
A modern simfile parsing & editing library for Python 3.
Full documentation can be found on Read the Docs.
Features
- Supports both SM and SSC files
- Timing data support
- Beat ↔︎ song time conversion
- Handles BPM changes, stops, delays and warps
- Accepts "split timing" from SSC charts
- Note streams from charts
- Fully typed, documented, and tested API
Installation
simfile is available on PyPI:
pip3 install simfile
Quickstart
Load simfiles from disk using simfile.open
or simfile.load
:
>>> import simfile
>>> springtime = simfile.open('testdata/Springtime/Springtime.ssc')
>>> springtime
<SSCSimfile: Springtime>
>>> with open('testdata/nekonabe/nekonabe.sm', 'r') as infile:
... nekonabe = simfile.load(infile)
...
>>> nekonabe
<SMSimfile: 猫鍋>
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'] is springtime.artist
True
>>> list(springtime.keys())[:7]
['VERSION', 'TITLE', 'SUBTITLE', 'ARTIST', 'TITLETRANSLIT', 'SUBTITLETRANSLIT', 'ARTISTTRANSLIT']
Charts are stored in a list under the .charts
attribute and function similarly to simfile objects:
>>> len(springtime.charts)
9
>>> chart = springtime.charts[0]
>>> chart
<SSCChart: dance-single Challenge 12>
>>> list(chart.keys())[:7]
['CHARTNAME', 'STEPSTYPE', 'DESCRIPTION', 'CHARTSTYLE', 'DIFFICULTY', 'METER', 'RADARVALUES']
Developing
simfile uses Pipenv for dependency management. Activate the environment:
pipenv shell
To run the unit tests:
py -m unittest
To build the documentation:
docs/make html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file simfile-2.1.1.tar.gz
.
File metadata
- Download URL: simfile-2.1.1.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7885f8395cdd0f19cd79da34e5675da778aa0e8dda76543cf075e21b862c4b7 |
|
MD5 | 46c1f7f836a282b678ac6401d418e93f |
|
BLAKE2b-256 | fe75156a1913b0a6636dfc76ac8a28da9b8a9da859fc3bb8ea5a15176f0e077d |
File details
Details for the file simfile-2.1.1-py3-none-any.whl
.
File metadata
- Download URL: simfile-2.1.1-py3-none-any.whl
- Upload date:
- Size: 42.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 133094a33cf6b841ca7e620880ef8354c56dd4aef6b2c77582de7f120f69c620 |
|
MD5 | a78bff3ff4431ad2cb785d15343c37e6 |
|
BLAKE2b-256 | dff9b0c67f88f6aa15697cecb941ccfa7cb3377296ac14c8c9fceea326f05d81 |