This PR introduces several new features for navigating simfile content on filesystems:
simfile.dir
A new dir module offers SimfileDirectory and SimfilePack classes for working with simfile & pack directories.
Navigating these directory structures is simple in theory, but writing filesystem code is error-prone and easy to get subtly wrong. My own unit tests caught multiple errors in my initial implementation!
simfile.assets
A new assets module handles loading simfile assets in a fashion that reproduces StepMania's behavior.
In particular, when an asset property (e.g. BANNER) is left blank, StepMania scans the simfile directory for images matching a few patterns. Each asset type has its own hardcoded set of patterns that you would never guess without reading StepMania's source code. Now you don't have to!
PyFilesystem2
PyFS has been added as a dependency & integrated throughout the library's filesystem interactions. Non-OS filesystems can be specified as an optional filesystem parameter everywhere the filesystem is used, including the dir module's classes and existing top-level functions like simfile.open. When no filesystem is provided, the library operates on the OS filesystem as before.
This enables e.g. loading simfiles from an archive file without having to either:
Expand the archive to disk, risking resource exhaustion & lowering throughput.
Write bespoke directory navigation code for each archive format you want to support, including unit tests.
simfile.opendir, simfile.openpack
New top-level methods that return or yield Simfile objects. These effectively tuck away the dir module's functionality into an API analogous to simfile.open.
This PR introduces several new features for navigating simfile content on filesystems:
simfile.dir
A new
dir
module offersSimfileDirectory
andSimfilePack
classes for working with simfile & pack directories.Navigating these directory structures is simple in theory, but writing filesystem code is error-prone and easy to get subtly wrong. My own unit tests caught multiple errors in my initial implementation!
simfile.assets
A new
assets
module handles loading simfile assets in a fashion that reproduces StepMania's behavior.In particular, when an asset property (e.g. BANNER) is left blank, StepMania scans the simfile directory for images matching a few patterns. Each asset type has its own hardcoded set of patterns that you would never guess without reading StepMania's source code. Now you don't have to!
PyFilesystem2
PyFS has been added as a dependency & integrated throughout the library's filesystem interactions. Non-OS filesystems can be specified as an optional
filesystem
parameter everywhere the filesystem is used, including thedir
module's classes and existing top-level functions likesimfile.open
. When nofilesystem
is provided, the library operates on the OS filesystem as before.This enables e.g. loading simfiles from an archive file without having to either:
simfile.opendir
,simfile.openpack
New top-level methods that return or yield Simfile objects. These effectively tuck away the
dir
module's functionality into an API analogous tosimfile.open
.TODO
filesystem
parameters