MusicBrainz metadata provider with serialized, throttled requests.
More...
|
| None | __init__ (self, *, str contact, str app_name="libMusicForge", str app_version="0.1.0", httpx.AsyncClient|None client=None, float min_interval=1.1, int max_retries=2) |
| | Initialize the configured instance.
|
| Self | __aenter__ (self) |
| | Enter the asynchronous context.
|
| None | __aexit__ (self, *object _exc) |
| | Exit the asynchronous context.
|
| None | aclose (self) |
| | Close the HTTP client if owned by this adapter.
|
| list[Recording] | search_recordings (self, str artist, str title) |
| | Search recordings; results may represent multiple performances.
|
| "RecordingDetails | None" | get_recording_details (self, Identifier identifier) |
| | Fetch release context for a specific MusicBrainz recording.
|
| Recording|None | get_recording (self, Identifier identifier) |
| | Retrieve recording metadata by identifier.
|
| Release|None | get_release (self, Identifier identifier) |
| | Retrieve release metadata by identifier.
|
|
| dict[str, Any] | _get (self, str path, dict[str, str] params) |
MusicBrainz metadata provider with serialized, throttled requests.
Instances own their HTTP client unless one is supplied for testing. Use as an async context manager or call aclose() when finished.
◆ __init__()
| None musicforge.providers.musicbrainz.MusicBrainzAdapter.__init__ |
( |
| self, |
|
|
* | , |
|
|
str | contact, |
|
|
str | app_name = "libMusicForge", |
|
|
str | app_version = "0.1.0", |
|
|
httpx.AsyncClient | None | client = None, |
|
|
float | min_interval = 1.1, |
|
|
int | max_retries = 2 ) |
Initialize the configured instance.
- Parameters
-
| self | Current instance. |
| contact | Contact address for the User-Agent. |
| app_name | Application name for the User-Agent. |
| app_version | Application version for the User-Agent. |
| client | Optional externally owned HTTP client. |
| min_interval | Minimum request spacing in seconds. |
| max_retries | Maximum retries after initial request. |
◆ __aenter__()
| Self musicforge.providers.musicbrainz.MusicBrainzAdapter.__aenter__ |
( |
| self | ) |
|
Enter the asynchronous context.
- Parameters
-
- Returns
- Current instance.
◆ __aexit__()
| None musicforge.providers.musicbrainz.MusicBrainzAdapter.__aexit__ |
( |
| self, |
|
|
*object | _exc ) |
Exit the asynchronous context.
- Parameters
-
| self | Current instance. |
| _exc | Context exit exception information. |
◆ _get()
| dict[str, Any] musicforge.providers.musicbrainz.MusicBrainzAdapter._get |
( |
| self, |
|
|
str | path, |
|
|
dict[str, str] | params ) |
|
protected |
◆ aclose()
| None musicforge.providers.musicbrainz.MusicBrainzAdapter.aclose |
( |
| self | ) |
|
Close the HTTP client if owned by this adapter.
- Parameters
-
◆ get_recording()
| Recording | None musicforge.providers.musicbrainz.MusicBrainzAdapter.get_recording |
( |
| self, |
|
|
Identifier | identifier ) |
Retrieve recording metadata by identifier.
- Parameters
-
| self | Current instance. |
| identifier | Provider-scoped entity identifier. |
- Returns
- Recording, or None if not found.
◆ get_recording_details()
| "RecordingDetails | None" musicforge.providers.musicbrainz.MusicBrainzAdapter.get_recording_details |
( |
| self, |
|
|
Identifier
| identifier ) |
Fetch release context for a specific MusicBrainz recording.
- Parameters
-
| self | Current instance. |
| identifier | Provider-scoped entity identifier. |
- Returns
- Recording and release context, or None if not found.
◆ get_release()
| Release | None musicforge.providers.musicbrainz.MusicBrainzAdapter.get_release |
( |
| self, |
|
|
Identifier | identifier ) |
Retrieve release metadata by identifier.
- Parameters
-
| self | Current instance. |
| identifier | Provider-scoped entity identifier. |
- Returns
- Release, or None if not found.
◆ search_recordings()
| list[Recording] musicforge.providers.musicbrainz.MusicBrainzAdapter.search_recordings |
( |
| self, |
|
|
str | artist, |
|
|
str | title ) |
Search recordings; results may represent multiple performances.
- Parameters
-
| self | Current instance. |
| artist | Artist name. |
| title | Track title. |
- Returns
- Matching recording candidates.
◆ _client
| musicforge.providers.musicbrainz.MusicBrainzAdapter._client = client or httpx.AsyncClient(timeout=15.0) |
|
protected |
◆ _last_request
| float | None musicforge.providers.musicbrainz.MusicBrainzAdapter._last_request = None |
|
protected |
◆ _lock
| musicforge.providers.musicbrainz.MusicBrainzAdapter._lock = asyncio.Lock() |
|
protected |
◆ _max_retries
| musicforge.providers.musicbrainz.MusicBrainzAdapter._max_retries = max_retries |
|
protected |
◆ _min_interval
| musicforge.providers.musicbrainz.MusicBrainzAdapter._min_interval = min_interval |
|
protected |
◆ _owns_client
| musicforge.providers.musicbrainz.MusicBrainzAdapter._owns_client = client is None |
|
protected |
◆ _user_agent
| str musicforge.providers.musicbrainz.MusicBrainzAdapter._user_agent = f"{app_name}/{app_version} ({contact})" |
|
protected |
The documentation for this class was generated from the following file: