Content Resolvers

From Silhouette Wiki
Jump to navigation Jump to search

One or more "content resolvers" can be registered to provide virtual mappings of source media paths. Resolvers have a scheme which Silhouette will use to associate a virtual path with the resolver. Virtual paths must start with the scheme name and a :/ prefix.

When media is imported into Silhouette from the UI, all content resolvers will be called to attempt to translate the path into a virtualized one, starting with the resolver scheme. When the media is later loaded by the IO module, the same resolver will be called to resolve the path back into a real file-system path.

Note that creating a Source from inside Python won't automatically invoke the content resolver import system. Scripts should provide pre-virtualized paths when desired.

Attributes

Name Description
name the resolver's name
scheme the resolver's scheme

Methods

Name Description
importFile(path) When a media file is imported, Silhouette will call the importFile() method of every registered resolver. If the resolver recognizes the media path in some way, it can return an adjusted virtual path for Silhouette to use instead.
resolve(path) If the resolver's scheme matches that of path, the resolver should return the actual file-system location of the path.

SFX Resolver

Silhouette has a built-in resolver for handling media rooted in a directory specified by the SFX_MEDIA environment variable. If the imported media has a root directory inside SFX_MEDIA, the resolver will replace the root path with the sfx:/ scheme. When resolved, it replaces the scheme with the variable $(SFX_MEDIA), which is then resolved the usual way involving environment variables. This resolver only registers itself if the SFX_MEDIA variable is set.

The code for the sfx resolver is in in resources/scripts/resolvers/sfx_media.py.