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:
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: fs.base.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
:Optional[str] Absolute path to the SM file, if present.
-
ssc_path
:Optional[str] Absolute path to the SSC file, if present.
-
property
simfile_path
(self) The SSC path if present, otherwise the SM path.
-
open
(self, **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
(self) → 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_dir
containing an SM or SSC file are included. Simfiles aren’t guaranteed to appear in any particular order.-
simfile_dir_paths
:Tuple[str] Absolute paths to the simfile directories in this pack.
-
simfile_dirs
(self) → Iterator[SimfileDirectory] Iterator over the simfile directories in the pack.
-
simfiles
(self, **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
(self) Get the name of the pack (the directory name by itself).
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.
-