foley.sources.openverse.adapter#
Openverse retrieve adapter: keyless audio search with ready attribution strings.
search calls /v1/audio/ (anonymous: page_size ≤ 20, Freesound and Jamendo rows
excluded, see the config) with the licence filter pushed into the query, then re-checks
each row’s licence fail-closed through foley.sources._license_gate.license_for_item()
(Openverse does not verify licences: a row’s licence is the one its origin provider
reported, trusted like Freesound’s own field; the landing page is the check for anything
that matters). The terms’ “made using Openverse” notice is stamped on each licence record
(notice_text_required), so the credits carry it. Durations arrive in milliseconds. download fetches
the row’s url (cached from search, else resolved from /audio/{id}/). HTTP and the
429 sleep are injected.
Module Attributes
Registry convention (arioso): the loader imports |
Classes
Registry convention (arioso): the loader imports |
|
|
Keyless Openverse adapter (a |
- foley.sources.openverse.adapter.Adapter#
Registry convention (arioso): the loader imports
adapter.Adapter.
- class foley.sources.openverse.adapter.OpenverseAdapter(config=None, *, include_freesound=False, http=None)[source]#
Bases:
objectKeyless Openverse adapter (a
SourceAdapter).- Parameters:
- download(source_id)[source]#
The row’s audio bytes (from the URL a search hit gave, else resolved by id).
- Return type:
- get(source_id)[source]#
Resolve one row id (a UUID) to its record.
- Raises:
LookupError – If its licence is not accepted.
- Return type:
- invoke_native(path, **params)[source]#
GET an Openverse API
pathwith nativeparams; return the parsed JSON (#61).It bypasses the licence filter and the per-item licence check that
search()applies: the caller owns licence gating for what comes back.- Return type:
- search(query, *, license='cc0', k=15, page=1, include_explicit=False, sources=None, kind='sfx', provider_params=None, include_pronunciations=False, **kw)[source]#
Search Openverse audio for
query; return licence-checked candidates.- Parameters:
license (
Optional[str]) – A licence id ('cc0'is an alias for CC0-1.0) keeps only rows under it, and is pushed into the nativelicensefilter (CC0, CC-BY or PDM);Noneasks for CC0, CC-BY and public-domain-mark rows.k (
int) – Max rows (anonymous limit 20).page (
int) – The results page (1-based,kper page).include_explicit (
bool) – Also return rows Openverse marks mature.sources (
Optional[list]) – Only these Openverse providers (wikimedia_audio, …); the excluded ones (Freesound, Jamendo) stay excluded, so asking only for them returns nothing.kind (
str) –sfx(default, no category filter) ormusic.include_pronunciations (
bool) – Keep recordings of a person saying a word (Lingua Libre’sLL-Q…files, rows Openverse files aspronunciation); dropped by default, as Commons drops them (#295, #319).provider_params (
Optional[dict]) – Native search params merged over the translated ones (#61); the per-item licence check still applies.
- Return type: