foley.sources.internet_archive.adapter#

Internet Archive retrieve adapter: opt-in discovery of archival sounds, never auto-verified.

Items come from advancedsearch.php restricted to audio with a licenseurl. Each item’s licence string goes through the one licence SSOT and the config’s allowlist, and every candidate gets rights_verified=False whatever it says: the field is what the uploader asserted. So foley.sources.pull.add_from() skips these until a person has confirmed an item; the adapter is for finding and fetching, not for clearing. Constructing it without the opt-in raises SourceConfigurationError.

Module Attributes

Adapter

Registry convention (arioso): the loader imports adapter.Adapter.

Classes

Adapter

Registry convention (arioso): the loader imports adapter.Adapter.

InternetArchiveAdapter([config, opt_in, http])

Opt-in Internet Archive adapter (a SourceAdapter).

foley.sources.internet_archive.adapter.Adapter#

Registry convention (arioso): the loader imports adapter.Adapter.

class foley.sources.internet_archive.adapter.InternetArchiveAdapter(config=None, *, opt_in=None, http=None)[source]#

Bases: object

Opt-in Internet Archive adapter (a SourceAdapter).

Parameters:
download(source_id)[source]#

The first audio file of the item under max_file_bytes (see the config).

Raises:

LookupError – If the item’s licence is not accepted (checked here too, so a direct call cannot fetch what a search would have dropped), or it has no suitable audio file.

Return type:

bytes

get(source_id)[source]#

Resolve one item identifier to its record.

Raises:

LookupError – If the item is missing or its licence is not accepted.

Return type:

SoundRecord

invoke_native(url, **params)[source]#

GET an Internet Archive url with native params; 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:

dict

search(query, *, license=None, k=15, page=1, sources=None, provider_params=None, **kw)[source]#

Search archive audio for query; return candidates (all unverified).

license is a licence id ('CC0-1.0'; 'cc0' is an alias) and keeps only items under it; None keeps every accepted licence. The default is None, unlike the other CC sources’ 'cc0', because every archive licence is an unverified claim anyway; add_from always passes its own ('cc0') default. The query always asks for items with a licenseurl. page is the results page (1-based, k per page); sources restricts it to these archive collections. provider_params are native advancedsearch params merged over the translated ones (#61); a q is ANDed onto foley’s as one group, never replaces it (the config’s provider_params policy). One that names mediatype raises SearchArgumentError, whatever the licence: ANDed with foley’s mediatype:audio it could match nothing (#203). A collection: clause is fine, and with sources it narrows them.

Return type:

list[Candidate]