foley.sources.music_library.config#
SOURCE_CONFIGS for the music libraries: one retrieve source per free library (#212).
Each free MusicLibrary in
MUSIC_LIBRARIES is a live retrieve
source of its own name (incompetech), so foley.add_from("incompetech",
query="Sneaky Snitch") runs it through the licence gate, ingest_one and the run
manifest like any other source. A paid library is not a source: it never downloads.
SOURCE_CONFIGS is a function, not a tuple: the registry
(foley.sources.registry.discover_sources()) calls it on every discovery pass,
so a library added with
register_music_library() becomes a
source without a config file of its own. Each config is built by
library_source_config() from the library itself and from
MUSIC_LIBRARY_HTTP (the pace, the
Retry-After cap, free pricing, external egress), so the polite fetch and the
source share one declaration.
>>> cfg = library_source_config(MUSIC_LIBRARIES["incompetech"])
>>> cfg["kind"], cfg["license"]["accepted_license_ids"], cfg["pricing"]["unit"]
('retrieve', ['CC-BY-4.0'], 'free')
>>> [c["name"] for c in SOURCE_CONFIGS()]
['incompetech']
Module Attributes
The id CC0 has in foley's licence table ( |
|
The pip extra a library source needs (the lazy |
Functions
|
The configs of the free libraries registered now ( |
|
The |
|
The |
- foley.sources.music_library.config.CC0_LICENSE_ID: str = 'CC0-1.0'#
The id CC0 has in foley’s licence table (
license='cc0'keeps it).
- foley.sources.music_library.config.EXTRA: str = 'music-library'#
The pip extra a library source needs (the lazy
requests).
- foley.sources.music_library.config.SOURCE_CONFIGS(libraries=None)[source]#
The configs of the free libraries registered now (
libraries: defaultMUSIC_LIBRARIES).
- foley.sources.music_library.config.library_source_config(library)[source]#
The
SOURCE_CONFIGof the freelibrary.- Raises:
MusicLibraryError – If
libraryis paid (a paid library is not a source).- Return type:
- foley.sources.music_library.config.license_section(library)[source]#
The
licenseblock oflibrary’s source: its one licence, from its URL.search_defaultisNone: a library has one licence, soadd_from’s default does not narrow it to CC0 (an explicitlicense=still does, fail closed). Each item’sLicenseRecordis stilltrack_license()’s, gated per call.- Return type: