simfile.base

Base classes for simfile & chart implementations.

This module should ideally never need to be used directly, but its documentation may be useful for understanding the similarities between the SM and SSC formats.

Module Contents

Classes

BaseChart

One chart from a simfile.

BaseCharts

List containing all of a simfile’s charts.

BaseSimfile

A simfile, including its metadata (e.g. song title) and charts.

class simfile.base.BaseChart

Bases: collections.OrderedDict, simfile._private.serializable.Serializable

One chart from a simfile.

All charts have the following known properties: stepstype, description, difficulty, meter, radarvalues, and notes.

stepstype
description
difficulty
meter
radarvalues
notes
classmethod blank(cls)

Generate a blank, valid chart populated with standard keys.

This should approximately match blank charts produced by the StepMania editor.

class simfile.base.BaseCharts(data=None)

Bases: simfile._private.generic.ListWithRepr[simfile._private.generic.E], simfile._private.serializable.Serializable

List containing all of a simfile’s charts.

serialize(self, file: TextIO)

Write the object to provided text file object as MSD.

class simfile.base.BaseSimfile(*, file: Optional[Union[TextIO, Iterator[str]]] = None, string: Optional[str] = None, strict: bool = True)

Bases: collections.OrderedDict, simfile._private.serializable.Serializable

A simfile, including its metadata (e.g. song title) and charts.

Metadata is stored directly on the simfile object through a dict-like interface. Keys are unique (if there are duplicates, the last value wins) and converted to uppercase.

Additionally, properties recognized by the current stable version of StepMania are exposed through lower-case properties on the object for easy (and implicitly spell-checked) access. The following known properties are defined:

  • Metadata: title, subtitle, artist, titletranslit, subtitletranslit, artisttranslit, genre, credit, samplestart, samplelength, selectable, instrumenttrack, timesignatures

  • File paths: banner, background, lyricspath, cdtitle, music

  • Gameplay events: bgchanges, fgchanges, keysounds, attacks, tickcounts

  • Timing data: offset, bpms, stops, delays

If a desired simfile property isn’t in this list, it can still be accessed as a dict item.

By default, the underlying parser will throw an exception if it finds any stray text between parameters. This behavior can be overridden by setting strict to False in the constructor.

MULTI_VALUE_PROPERTIES = ['ATTACKS', 'DISPLAYBPM']
title
subtitle
artist
titletranslit
subtitletranslit
artisttranslit
genre
credit
banner
background
lyricspath
cdtitle
music
offset
bpms
stops
delays
timesignatures
tickcounts
instrumenttrack
samplestart
samplelength
displaybpm
selectable
bgchanges
fgchanges
keysounds
attacks
property charts(self)BaseCharts

List of charts associated with this simfile.

classmethod blank(cls)

Generate a blank, valid simfile populated with standard keys.

This should approximately match the simfile produced by the StepMania editor in a directory with no .sm or .ssc files.

serialize(self, file: TextIO)

Write the object to provided text file object as MSD.