search¶
Types for wrapping search results from providers.
| CLASS | DESCRIPTION |
|---|---|
SearchResult |
A wrapper for search results that tracks their provider origin. |
SearchResult
dataclass
¶
SearchResult(
provider: str,
result: T,
original: T | None = None,
_match: MatchResult = None,
)
Bases: Generic[T]
A wrapper for search results that tracks their provider origin.
This generic class wraps any BaseLibraryItem subtype (Song, Album, Artist, etc.)
and associates it with the provider it came from. It also supports transparent
attribute access to the wrapped result.
| ATTRIBUTE | DESCRIPTION |
|---|---|
provider |
Name of the provider that returned this result (e.g., "spotify", "youtube_music").
TYPE:
|
result |
The actual library item returned by the search.
TYPE:
|
original |
Optional reference to the original item being searched for, useful for matching.
TYPE:
|
Example
result = SearchResult(provider="spotify", result=song) result.name # Delegates to song.name "Never Gonna Give You Up" result.resource_type ResourceType.SONG
resource_type
property
¶
resource_type: ResourceType
Returns the resource type of the wrapped result.
__getattr__
¶
__getattr__(name: str)
Delegate attribute access to the wrapped result object.
Source code in src/downmixer/types/search.py
56 57 58 | |
__dir__
¶
__dir__()
Include wrapped result's attributes in dir() for better introspection/IDE completion.
Source code in src/downmixer/types/search.py
60 61 62 | |