foley.index.license_sidecar#
A licence stated once per folder: the sidecar for owned sound packs (#229).
A purchased pack’s licence is not in its files, so the user writes it once, in a
foley-license.toml (or foley-license.json) at the pack’s root:
license = "owned-pack" # a foley.licensing.LICENSE_FLAGS row
licensor = "Sonniss"
pack = "GDC 2024 Game Audio Bundle"
license_url = "https://sonniss.com/gdc-bundle-license" # optional
attribution = "Sound effects: Sonniss GDC 2024" # optional
ai_training = false # optional: can only narrow the row's flag
A file takes the nearest sidecar in its folder or above (up to root), so a
sub-folder can override its pack. The licence goes through the licence SSOT
(foley.licensing.apply_license_flags()) like any asserted licence, and only an
id the user may assert (foley.licensing.ASSERTABLE_LICENSE_IDS) is taken. A
sidecar can narrow a grant, never widen it: ai_training = true does not unlock
training a licence forbids. Fail-closed: no sidecar, two in one folder, an unreadable
one, an unknown key or an unassertable licence raises SidecarError; nothing
is guessed.
Module Attributes
Sidecar file names, by precedence within one folder. |
|
The keys a sidecar may hold, with their types; |
|
|
Functions
|
|
|
The nearest sidecar for |
|
A sidecar's fields, checked against |
|
The |
Exceptions
A missing, unreadable or invalid licence sidecar: the file is not ingested. |
- foley.index.license_sidecar.SIDECAR_FIELDS = {'ai_training': <class 'bool'>, 'attribution': <class 'str'>, 'license': <class 'str'>, 'license_url': <class 'str'>, 'licensor': <class 'str'>, 'pack': <class 'str'>}#
The keys a sidecar may hold, with their types;
licenseis required.
- foley.index.license_sidecar.SIDECAR_NAMES = ('foley-license.toml', 'foley-license.json')#
Sidecar file names, by precedence within one folder.
- foley.index.license_sidecar.SIDECAR_SOURCE = 'licensed_library'#
LicenseRecord.sourceof a sound whose licence a sidecar states.
- exception foley.index.license_sidecar.SidecarError[source]#
Bases:
ValueErrorA missing, unreadable or invalid licence sidecar: the file is not ingested.
- foley.index.license_sidecar.as_walked(path)[source]#
pathas a library tree is walked:~expanded, made absolute and normalised withos.path.abspath, symlinks NOT followed. Use it for a root and the files under it alike, so they compare (resolve()would turn macOS/varinto/private/varon one side only).- Return type:
- foley.index.license_sidecar.find_sidecar(path, *, root=None)[source]#
The nearest sidecar for
path(a file or folder), searching up toroot.root(default: the filesystem root) bounds the search, so a library folder never inherits a sidecar from above it. The path is walked as given, not through symlinks, so a linked file takes the sidecar of the folder it is listed in.- Raises:
SidecarError – If
pathis not underroot, or a folder holds two sidecars, or a sidecar name is not a file.- Return type:
- foley.index.license_sidecar.read_sidecar(sidecar)[source]#
A sidecar’s fields, checked against
SIDECAR_FIELDS.- Raises:
SidecarError – If it cannot be parsed, holds an unknown key or a wrong type, lacks
license, or names a licence that has noLICENSE_FLAGSrow.- Return type:
- foley.index.license_sidecar.sidecar_license(path, *, root=None)[source]#
The
LicenseRecordthe nearest sidecar asserts forpath.rights_verifiedisTrue(the user asserted it, as withfoley.ingest(path, license=...)), the flags come from the licence row, andai_training = falsenarrows the row’s flag (truenever widens it). The licensor is the rights holder; the pack is named inlicense_nameafter the licence’s own name ("CC0 1.0 Universal (Public Domain Dedication) (GDC 2024)").- Raises:
SidecarError – If no sidecar covers
path(up toroot), or it is invalid.- Return type: