providers¶
Defines base provider classes and give default lyrics, info and audio providers. For more information on Downmixer's providers system, refer to the Providers page.
| MODULE | DESCRIPTION |
|---|---|
connections |
Connection classes for managing provider service connections. |
protocols |
Protocol definitions for music provider capabilities. |
| CLASS | DESCRIPTION |
|---|---|
BaseProvider |
Base class for all music providers. |
ProviderInformation |
Information about a provider including its supported protocols and connections. This class facilitates |
BaseProvider
¶
BaseProvider(
connection: Connection,
options: dict | None = None,
logger: "LoggerLike" = ConsoleLogger(),
)
Base class for all music providers.
Providers are the main interface for interacting with music services. Each provider
must define a _name, _pretty_name (publicly accessible via properties), and implement the required protocol
methods for their supported capabilities.
Additionally, a provider can specify default options dictionary with the
_default_options parameter - this value will be merged with the options passed by the user using the
merge_dicts_with_priority function.
| ATTRIBUTE | DESCRIPTION |
|---|---|
connection |
The active connection to the provider's service.
TYPE:
|
client |
The underlying API client from the connection.
TYPE:
|
Initializes the provider object. If applicable, does not authenticate to the service.
| PARAMETER | DESCRIPTION |
|---|---|
|
Dictionary of options to pass to the provider. See documentation for each provider for available options.
TYPE:
|
|
Logger-like object to use for logging. If None, uses the default logger.
TYPE:
|
Source code in src/downmixer/providers/__init__.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
change_connection
¶
change_connection(new: Connection) -> None
Change the provider's Connection object, ensuring that it's ready attributes are set.
Warning
It's not guaranteed that a connection change will go well. None of the built-in providers have issues with this, however be careful when using third-party or custom providers.
| PARAMETER | DESCRIPTION |
|---|---|
|
Connection object to be changed.
TYPE:
|
Source code in src/downmixer/providers/__init__.py
82 83 84 85 86 87 88 89 90 91 92 93 | |
get_connections
classmethod
¶
get_connections() -> list[type[Connection]]
Return the list of connection types supported by this provider.
| RETURNS | DESCRIPTION |
|---|---|
list[type[Connection]]
|
A list of Connection subclasses that can be used with this provider. |
Source code in src/downmixer/providers/__init__.py
95 96 97 98 99 100 101 102 | |
__getattr__
¶
__getattr__(name: str)
Proxy attribute access to the underlying connection object.
Source code in src/downmixer/providers/__init__.py
104 105 106 | |
ProviderInformation
dataclass
¶
ProviderInformation(
class_name: str,
class_ref: type,
protocols: list[type[Protocol]] = list(),
connections: list[type[Connection]] = list(),
)
Information about a provider including its supported protocols and connections. This class facilitates parsing of providers and their supported protocols.
| ATTRIBUTE | DESCRIPTION |
|---|---|
class_name |
The name of the provider class.
TYPE:
|
class_ref |
A reference to the provider class itself.
TYPE:
|
protocols |
List of protocol classes the provider implements.
TYPE:
|
connections |
List of connection classes the provider supports.
TYPE:
|
protocols
class-attribute
instance-attribute
¶
protocols: list[type[Protocol]] = field(
default_factory=list
)
connections
class-attribute
instance-attribute
¶
connections: list[type[Connection]] = field(
default_factory=list
)
__contains__
¶
__contains__(item)
Source code in src/downmixer/providers/__init__.py
179 180 181 182 183 184 185 186 187 | |
__hash__
¶
__hash__()
Source code in src/downmixer/providers/__init__.py
189 190 | |
__eq__
¶
__eq__(other)
Source code in src/downmixer/providers/__init__.py
192 193 194 195 | |
list_providers
¶
list_providers() -> list[type[BaseProvider]]
Discover and return all available provider classes.
Scans the providers package for subpackages containing a get_provider function
and collects all provider classes.
| RETURNS | DESCRIPTION |
|---|---|
list[type[BaseProvider]]
|
A list of BaseProvider subclasses found in the providers package. |
Source code in src/downmixer/providers/__init__.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
list_protocols
¶
list_protocols() -> list[type[Protocol]]
Return all protocol classes defined in the protocols module.
| RETURNS | DESCRIPTION |
|---|---|
list[type[Protocol]]
|
A list of Protocol subclasses (e.g., SupportsMetadata, SupportsAudioDownload). |
Source code in src/downmixer/providers/__init__.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
get_provider_info
¶
get_provider_info(
provider: type[BaseProvider],
) -> ProviderInformation
Source code in src/downmixer/providers/__init__.py
198 199 200 201 202 203 204 205 206 | |
get_all_providers_info
¶
get_all_providers_info() -> list[ProviderInformation]
Get detailed information about all available providers.
| RETURNS | DESCRIPTION |
|---|---|
list[ProviderInformation]
|
A list of ProviderInformation objects, each containing the provider's |
list[ProviderInformation]
|
class name, class reference, implemented protocols, and supported connections. |
Source code in src/downmixer/providers/__init__.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |