From b099c9747018bfadf7d47337b2bce6092d4a277e Mon Sep 17 00:00:00 2001 From: Jonathan Bangert Date: Mon, 29 May 2023 12:23:49 +0200 Subject: [PATCH] feat(name): rename to deezer-async --- .../server/providers/deezer/__init__.py | 27 ++++++++++++++++--- .../server/providers/deezer/manifest.json | 2 +- requirements_all.txt | 2 +- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/music_assistant/server/providers/deezer/__init__.py b/music_assistant/server/providers/deezer/__init__.py index bd1da036..ae55ede6 100644 --- a/music_assistant/server/providers/deezer/__init__.py +++ b/music_assistant/server/providers/deezer/__init__.py @@ -2,6 +2,7 @@ import hashlib from asyncio import TaskGroup from collections.abc import AsyncGenerator +from dataclasses import dataclass from math import ceil import deezer @@ -44,7 +45,6 @@ from music_assistant.server.models.music_provider import MusicProvider from music_assistant.server.server import MusicAssistant from .gw_client import GWClient -from .helpers import Credential, DeezerClient SUPPORTED_FEATURES = ( ProviderFeature.LIBRARY_ARTISTS, @@ -67,6 +67,22 @@ SUPPORTED_FEATURES = ( 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" @@ -122,7 +138,7 @@ async def get_config_entries( class DeezerProvider(MusicProvider): # pylint: disable=W0223 """Deezer provider support.""" - client: DeezerClient + client: deezer.Client gw_client: GWClient creds: Credential _throttler: Throttler @@ -143,8 +159,11 @@ class DeezerProvider(MusicProvider): # pylint: disable=W0223 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 diff --git a/music_assistant/server/providers/deezer/manifest.json b/music_assistant/server/providers/deezer/manifest.json index 0084ef1a..6c3fbf3f 100644 --- a/music_assistant/server/providers/deezer/manifest.json +++ b/music_assistant/server/providers/deezer/manifest.json @@ -5,6 +5,6 @@ "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 } diff --git a/requirements_all.txt b/requirements_all.txt index 92fb5a6f..132326c5 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -11,10 +11,10 @@ async-upnp-client==0.33.2 asyncio-throttle==1.0.2 coloredlogs==15.0.1 cryptography==40.0.2 -deezer-python==5.12.0 faust-cchardet>=2.1.18 git+https://github.com/gieljnssns/python-radios.git@main git+https://github.com/jozefKruszynski/python-tidal.git@v0.7.1 +git+https://github.com/music-assistant/deezer-python-async git+https://github.com/pytube/pytube.git@refs/pull/1501/head mashumaro==3.7 memory-tempfile==2.2.3 -- 2.34.1