simfile.dir
Module Contents
Classes
A simfile directory, containing an SM and/or SSC file, or neither. |
|
A simfile pack directory, containing any number of simfile directories. |
- exception simfile.dir.DuplicateSimfileError
Bases:
ExceptionRaised when a simfile directory contains multiple simfiles of the same type (e.g. two SM files).
- class simfile.dir.SimfileDirectory(simfile_dir: str, *, filesystem: fs.base.FS = NativeOSFS(), ignore_duplicate=False)
A simfile directory, containing an SM and/or SSC file, or neither.
Raises
DuplicateSimfileErrorif the directory contains multiple simfiles of the same type (e.g. two SM files).- property simfile_path
The SSC path if present, otherwise the SM path.
- sm_path: str | None
Absolute path to the SM file, if present.
- ssc_path: str | None
Absolute path to the SSC file, if present.
- 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
FileNotFoundErrorif 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: fs.base.FS = NativeOSFS(), ignore_duplicate: bool = False)
A simfile pack directory, containing any number of simfile directories.
Only immediate subdirectories of
pack_dircontaining an SM or SSC file are included. Simfiles aren’t guaranteed to appear in any particular order.- property name
Get the name of the pack (the directory name by itself).
- simfile_dir_paths: Tuple[str]
Absolute paths to the simfile directories in this pack.
- 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().
- 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.