yutipy 1.5.0__tar.gz → 1.5.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of yutipy might be problematic. Click here for more details.
- {yutipy-1.5.0 → yutipy-1.5.2}/PKG-INFO +1 -1
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/__init__.py +3 -2
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/deezer.py +2 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/exceptions.py +28 -14
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/itunes.py +2 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/kkbox.py +2 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/musicyt.py +6 -4
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/spotify.py +7 -4
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/utils/__init__.py +4 -1
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/yutipy_music.py +2 -2
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/PKG-INFO +1 -1
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/SOURCES.txt +0 -1
- yutipy-1.5.0/yutipy/logging.py +0 -3
- {yutipy-1.5.0 → yutipy-1.5.2}/.gitattributes +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/.github/FUNDING.yml +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/.github/workflows/pytest-unit-testing.yml +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/.github/workflows/release.yml +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/.gitignore +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/.readthedocs.yaml +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/LICENSE +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/MANIFEST.in +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/README.md +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/Makefile +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/_static/yutipy_header.png +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/_static/yutipy_logo.png +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/api_reference.rst +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/available_platforms.rst +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/cli.rst +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/conf.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/faq.rst +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/index.rst +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/installation.rst +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/make.bat +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/requirements.txt +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/docs/usage_examples.rst +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/pyproject.toml +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/requirements-dev.txt +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/requirements.txt +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/setup.cfg +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/tests/__init__.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_deezer.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_itunes.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_kkbox.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_models.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_musicyt.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_spotify.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_utils.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_yutipy_music.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/cli/__init__.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/cli/config.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/cli/search.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/models.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/utils/helpers.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/utils/logger.py +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/dependency_links.txt +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/entry_points.txt +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/requires.txt +0 -0
- {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/top_level.txt +0 -0
|
@@ -3,8 +3,8 @@ from .itunes import Itunes
|
|
|
3
3
|
from .kkbox import KKBox
|
|
4
4
|
from .musicyt import MusicYT
|
|
5
5
|
from .spotify import Spotify
|
|
6
|
+
from .utils import disable_logging, enable_logging
|
|
6
7
|
from .yutipy_music import YutipyMusic
|
|
7
|
-
from . import exceptions
|
|
8
8
|
|
|
9
9
|
__all__ = [
|
|
10
10
|
"Deezer",
|
|
@@ -13,5 +13,6 @@ __all__ = [
|
|
|
13
13
|
"MusicYT",
|
|
14
14
|
"Spotify",
|
|
15
15
|
"YutipyMusic",
|
|
16
|
-
"
|
|
16
|
+
"enable_logging",
|
|
17
|
+
"disable_logging",
|
|
17
18
|
]
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
""
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
__all__ = [
|
|
2
|
+
"AuthenticationException",
|
|
3
|
+
"InvalidResponseException",
|
|
4
|
+
"InvalidValueException",
|
|
5
|
+
"NetworkException",
|
|
6
|
+
"YutipyException",
|
|
7
|
+
]
|
|
5
8
|
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
# Base Exception
|
|
11
|
+
class YutipyException(Exception):
|
|
12
|
+
"""Base class for exceptions in the Yutipy package."""
|
|
9
13
|
|
|
10
14
|
pass
|
|
11
15
|
|
|
12
16
|
|
|
17
|
+
# Service Exceptions
|
|
13
18
|
class DeezerException(YutipyException):
|
|
14
19
|
"""Exception raised for errors related to the Deezer API."""
|
|
15
20
|
|
|
@@ -22,8 +27,8 @@ class ItunesException(YutipyException):
|
|
|
22
27
|
pass
|
|
23
28
|
|
|
24
29
|
|
|
25
|
-
class
|
|
26
|
-
"""Exception raised for
|
|
30
|
+
class KKBoxException(YutipyException):
|
|
31
|
+
"""Exception raised for erros related to the KKBOX Open API."""
|
|
27
32
|
|
|
28
33
|
pass
|
|
29
34
|
|
|
@@ -34,14 +39,15 @@ class MusicYTException(YutipyException):
|
|
|
34
39
|
pass
|
|
35
40
|
|
|
36
41
|
|
|
37
|
-
class
|
|
38
|
-
"""Exception raised for
|
|
42
|
+
class SpotifyException(YutipyException):
|
|
43
|
+
"""Exception raised for errors related to the Spotify API."""
|
|
39
44
|
|
|
40
45
|
pass
|
|
41
46
|
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
# Generic Exceptions
|
|
49
|
+
class AuthenticationException(YutipyException):
|
|
50
|
+
"""Exception raised for authentication errors."""
|
|
45
51
|
|
|
46
52
|
pass
|
|
47
53
|
|
|
@@ -52,5 +58,13 @@ class InvalidResponseException(YutipyException):
|
|
|
52
58
|
pass
|
|
53
59
|
|
|
54
60
|
|
|
55
|
-
class
|
|
56
|
-
"""Exception raised for
|
|
61
|
+
class InvalidValueException(YutipyException):
|
|
62
|
+
"""Exception raised for invalid values."""
|
|
63
|
+
|
|
64
|
+
pass
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class NetworkException(YutipyException):
|
|
68
|
+
"""Exception raised for network-related errors."""
|
|
69
|
+
|
|
70
|
+
pass
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
__all__ = ["MusicYT", "MusicYTException"]
|
|
2
|
+
|
|
2
3
|
from pprint import pprint
|
|
3
4
|
from typing import Optional
|
|
4
5
|
|
|
@@ -8,7 +9,7 @@ from ytmusicapi import YTMusic, exceptions
|
|
|
8
9
|
from yutipy.exceptions import (
|
|
9
10
|
InvalidResponseException,
|
|
10
11
|
InvalidValueException,
|
|
11
|
-
|
|
12
|
+
MusicYTException,
|
|
12
13
|
)
|
|
13
14
|
from yutipy.models import MusicInfo
|
|
14
15
|
from yutipy.utils.helpers import are_strings_similar, is_valid_string
|
|
@@ -86,8 +87,8 @@ class MusicYT:
|
|
|
86
87
|
try:
|
|
87
88
|
results = self.ytmusic.search(query=query, limit=limit)
|
|
88
89
|
except exceptions.YTMusicServerError as e:
|
|
89
|
-
logger.error(f"
|
|
90
|
-
raise
|
|
90
|
+
logger.error(f"Something went wrong while searching YTMusic: {e}")
|
|
91
|
+
raise MusicYTException(f"Something went wrong while searching YTMusic: {e}")
|
|
91
92
|
|
|
92
93
|
for result in results:
|
|
93
94
|
if self._is_relevant_result(artist, song, result):
|
|
@@ -294,6 +295,7 @@ class MusicYT:
|
|
|
294
295
|
|
|
295
296
|
if __name__ == "__main__":
|
|
296
297
|
import logging
|
|
298
|
+
|
|
297
299
|
from yutipy.utils.logger import enable_logging
|
|
298
300
|
|
|
299
301
|
enable_logging(level=logging.DEBUG)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
__all__ = ["Spotify", "SpotifyException"]
|
|
2
|
+
|
|
1
3
|
import base64
|
|
2
4
|
import os
|
|
3
5
|
import time
|
|
@@ -31,7 +33,7 @@ SPOTIFY_CLIENT_SECRET = os.getenv("SPOTIFY_CLIENT_SECRET")
|
|
|
31
33
|
|
|
32
34
|
class Spotify:
|
|
33
35
|
"""
|
|
34
|
-
A class to interact with the Spotify API.
|
|
36
|
+
A class to interact with the Spotify API. It uses "Client Credentials" grant type (or flow).
|
|
35
37
|
|
|
36
38
|
This class reads the ``SPOTIFY_CLIENT_ID`` and ``SPOTIFY_CLIENT_SECRET`` from environment variables or the ``.env`` file by default.
|
|
37
39
|
Alternatively, you can manually provide these values when creating an object.
|
|
@@ -43,14 +45,14 @@ class Spotify:
|
|
|
43
45
|
client_secret: str = SPOTIFY_CLIENT_SECRET,
|
|
44
46
|
) -> None:
|
|
45
47
|
"""
|
|
46
|
-
Initializes the Spotify class and sets up the session.
|
|
48
|
+
Initializes the Spotify class (using Client Credentials grant type/flow) and sets up the session.
|
|
47
49
|
|
|
48
50
|
Parameters
|
|
49
51
|
----------
|
|
50
52
|
client_id : str, optional
|
|
51
|
-
The Client ID for the Spotify API. Defaults to ``SPOTIFY_CLIENT_ID`` from
|
|
53
|
+
The Client ID for the Spotify API. Defaults to ``SPOTIFY_CLIENT_ID`` from environment variable or the ``.env`` file.
|
|
52
54
|
client_secret : str, optional
|
|
53
|
-
The Client secret for the Spotify API. Defaults to ``SPOTIFY_CLIENT_SECRET`` from
|
|
55
|
+
The Client secret for the Spotify API. Defaults to ``SPOTIFY_CLIENT_SECRET`` from environment variable or the ``.env`` file.
|
|
54
56
|
"""
|
|
55
57
|
if not client_id or not client_secret:
|
|
56
58
|
raise SpotifyException(
|
|
@@ -490,6 +492,7 @@ class Spotify:
|
|
|
490
492
|
|
|
491
493
|
if __name__ == "__main__":
|
|
492
494
|
import logging
|
|
495
|
+
|
|
493
496
|
from yutipy.utils.logger import enable_logging
|
|
494
497
|
|
|
495
498
|
enable_logging(level=logging.DEBUG)
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
from .helpers import (
|
|
2
|
-
guess_album_type,
|
|
3
2
|
are_strings_similar,
|
|
3
|
+
guess_album_type,
|
|
4
4
|
is_valid_string,
|
|
5
5
|
separate_artists,
|
|
6
6
|
)
|
|
7
|
+
from .logger import disable_logging, enable_logging
|
|
7
8
|
|
|
8
9
|
__all__ = [
|
|
9
10
|
"guess_album_type",
|
|
10
11
|
"are_strings_similar",
|
|
11
12
|
"is_valid_string",
|
|
12
13
|
"separate_artists",
|
|
14
|
+
"enable_logging",
|
|
15
|
+
"disable_logging"
|
|
13
16
|
]
|
|
@@ -33,7 +33,7 @@ class YutipyMusic:
|
|
|
33
33
|
|
|
34
34
|
try:
|
|
35
35
|
self.services["kkbox"] = KKBox()
|
|
36
|
-
except (KKBoxException
|
|
36
|
+
except (KKBoxException) as e:
|
|
37
37
|
logger.warning(
|
|
38
38
|
f"{self.__class__.__name__}: Skipping KKBox due to KKBoxException: {e}"
|
|
39
39
|
)
|
|
@@ -43,7 +43,7 @@ class YutipyMusic:
|
|
|
43
43
|
|
|
44
44
|
try:
|
|
45
45
|
self.services["spotify"] = Spotify()
|
|
46
|
-
except (SpotifyException
|
|
46
|
+
except (SpotifyException) as e:
|
|
47
47
|
logger.warning(
|
|
48
48
|
f"{self.__class__.__name__}: Skipping Spotify due to SpotifyException: {e}"
|
|
49
49
|
)
|
yutipy-1.5.0/yutipy/logging.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|