feat(name): rename to deezer-async
authorJonathan Bangert <jonathan@bangert.dk>
Mon, 29 May 2023 10:23:49 +0000 (12:23 +0200)
committerJonathan Bangert <jonathan@bangert.dk>
Mon, 29 May 2023 10:23:49 +0000 (12:23 +0200)
music_assistant/server/providers/deezer/__init__.py
music_assistant/server/providers/deezer/manifest.json
requirements_all.txt

index bd1da036abf669f6a19a26b1c5aeae9ff8d362fc..ae55ede661b9b86a958c4c695416f0602d029797 100644 (file)
@@ -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
 
index 0084ef1abfcd4111ea85985856a39bd653d72af0..6c3fbf3f5f38835696e1f7a68e8c188f89cbe379 100644 (file)
@@ -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
 }
index 92fb5a6fe2f179872a30079101c7b843c87c966a..132326c5f70740f3330b890791a84f41433ce720 100644 (file)
@@ -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