simfile.dir

Exceptions

DuplicateSimfileError

Raised when a simfile directory contains multiple simfiles of the same

Classes

SimfileDirectory

A simfile directory, containing an SM and/or SSC file, or neither.

SimfilePack

A simfile pack directory, containing any number of simfile directories.

Module Contents

exception simfile.dir.DuplicateSimfileError

Bases: Exception

Raised when a simfile directory contains multiple simfiles of the same type (e.g. two SM files).

class simfile.dir.SimfileDirectory(simfile_dir: str, *, filesystem: simfile._private.fs.FS = NativeOSFS(), ignore_duplicate=False)

A simfile directory, containing an SM and/or SSC file, or neither.

Raises DuplicateSimfileError if the directory contains multiple simfiles of the same type (e.g. two SM files).

sm_path: str | None = None

Absolute path to the SM file, if present.

ssc_path: str | None = None

Absolute path to the SSC file, if present.

simfile_dir = b'.'
filesystem
property simfile_path

The SSC path if present, otherwise the SM path.

open(**kwargs) simfile.types.Simfile

Open the simfile in this directory.

If both SSC and SM are present, SSC is preferred. Keyword arguments are passed down to simfile.open().

Raises FileNotFoundError if there is no SM or SSC file in the directory.

assets() simfile.assets.Assets

Get the file assets for this simfile.

class simfile.dir.SimfilePack(pack_dir: str, *, filesystem: simfile._private.fs.FS = NativeOSFS(), ignore_duplicate: bool = False)

A simfile pack directory, containing any number of simfile directories.

Only immediate subdirectories of pack_dir containing an SM or SSC file are included. Simfiles aren’t guaranteed to appear in any particular order.

simfile_dir_paths: Tuple[str, Ellipsis]

Absolute paths to the simfile directories in this pack.

pack_dir = b'.'
filesystem
simfile_dirs() Iterator[SimfileDirectory]

Iterator over the simfile directories in the pack.

simfiles(**kwargs) Iterator[simfile.types.Simfile]

Iterator over the simfiles in the pack.

If both SSC and SM are present in a simfile directory, SSC is preferred. Keyword arguments are passed down to simfile.open().

property name

Get the name of the pack (the directory name by itself).

banner() str | None

Get the pack’s banner image, if present, as an absolute path.

Follows the same logic as StepMania:

  • When there are multiple images in the pack directory, the banner is chosen first by extension priority (PNG is highest, then JPG, JPEG, GIF, BMP), then alphabetically.

  • If there are no images in the pack directory, checks for a banner alongside the pack with the same base name, using the same extension priority as before.