import hashlib
from asyncio import TaskGroup
from collections.abc import AsyncGenerator
+from dataclasses import dataclass
from math import ceil
import deezer
from music_assistant.server.server import MusicAssistant
from .gw_client import GWClient
-from .helpers import Credential, DeezerClient
SUPPORTED_FEATURES = (
ProviderFeature.LIBRARY_ARTISTS,
ProviderFeature.RECOMMENDATIONS,
)
+
+@dataclass
+class Credential:
+ """Class for storing credentials."""
+
+ def __init__(self, app_id: int, app_secret: str, access_token: str):
+ """Set the correct things."""
+ self.app_id = app_id
+ self.app_secret = app_secret
+ self.access_token = access_token
+
+ app_id: int
+ app_secret: str
+ access_token: str
+
+
CONF_ACCESS_TOKEN = "access_token"
CONF_ACTION_AUTH = "auth"
DEEZER_AUTH_URL = "https://connect.deezer.com/oauth/auth.php"
class DeezerProvider(MusicProvider): # pylint: disable=W0223
"""Deezer provider support."""
- client: DeezerClient
+ client: deezer.Client
gw_client: GWClient
creds: Credential
_throttler: Throttler
access_token=self.config.get_value(CONF_ACCESS_TOKEN), # type: ignore
)
try:
- deezer_client = await DeezerClient.get_deezer_client(self=None, creds=self.creds)
- self.client = DeezerClient(creds=self.creds, client=deezer_client)
+ self.client = deezer.Client(
+ app_id=self.creds.app_id,
+ app_secret=self.creds.app_secret,
+ access_token=self.creds.access_token,
+ )
except Exception as error:
raise LoginFailed("Invalid login credentials") from error
"description": "Support for the Deezer streaming provider in Music Assistant.",
"codeowners": ["@Un10ck3d", "@micha91"],
"documentation": "https://github.com/orgs/music-assistant/discussions/1245",
- "requirements": ["deezer-python==5.12.0", "pycryptodome==3.18.0"],
+ "requirements": ["git+https://github.com/music-assistant/deezer-python-async", "pycryptodome==3.18.0"],
"multi_instance": true
}