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.

Files changed (60) hide show
  1. {yutipy-1.5.0 → yutipy-1.5.2}/PKG-INFO +1 -1
  2. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/__init__.py +3 -2
  3. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/deezer.py +2 -0
  4. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/exceptions.py +28 -14
  5. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/itunes.py +2 -0
  6. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/kkbox.py +2 -0
  7. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/musicyt.py +6 -4
  8. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/spotify.py +7 -4
  9. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/utils/__init__.py +4 -1
  10. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/yutipy_music.py +2 -2
  11. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/PKG-INFO +1 -1
  12. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/SOURCES.txt +0 -1
  13. yutipy-1.5.0/yutipy/logging.py +0 -3
  14. {yutipy-1.5.0 → yutipy-1.5.2}/.gitattributes +0 -0
  15. {yutipy-1.5.0 → yutipy-1.5.2}/.github/FUNDING.yml +0 -0
  16. {yutipy-1.5.0 → yutipy-1.5.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  17. {yutipy-1.5.0 → yutipy-1.5.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  18. {yutipy-1.5.0 → yutipy-1.5.2}/.github/workflows/pytest-unit-testing.yml +0 -0
  19. {yutipy-1.5.0 → yutipy-1.5.2}/.github/workflows/release.yml +0 -0
  20. {yutipy-1.5.0 → yutipy-1.5.2}/.gitignore +0 -0
  21. {yutipy-1.5.0 → yutipy-1.5.2}/.readthedocs.yaml +0 -0
  22. {yutipy-1.5.0 → yutipy-1.5.2}/LICENSE +0 -0
  23. {yutipy-1.5.0 → yutipy-1.5.2}/MANIFEST.in +0 -0
  24. {yutipy-1.5.0 → yutipy-1.5.2}/README.md +0 -0
  25. {yutipy-1.5.0 → yutipy-1.5.2}/docs/Makefile +0 -0
  26. {yutipy-1.5.0 → yutipy-1.5.2}/docs/_static/yutipy_header.png +0 -0
  27. {yutipy-1.5.0 → yutipy-1.5.2}/docs/_static/yutipy_logo.png +0 -0
  28. {yutipy-1.5.0 → yutipy-1.5.2}/docs/api_reference.rst +0 -0
  29. {yutipy-1.5.0 → yutipy-1.5.2}/docs/available_platforms.rst +0 -0
  30. {yutipy-1.5.0 → yutipy-1.5.2}/docs/cli.rst +0 -0
  31. {yutipy-1.5.0 → yutipy-1.5.2}/docs/conf.py +0 -0
  32. {yutipy-1.5.0 → yutipy-1.5.2}/docs/faq.rst +0 -0
  33. {yutipy-1.5.0 → yutipy-1.5.2}/docs/index.rst +0 -0
  34. {yutipy-1.5.0 → yutipy-1.5.2}/docs/installation.rst +0 -0
  35. {yutipy-1.5.0 → yutipy-1.5.2}/docs/make.bat +0 -0
  36. {yutipy-1.5.0 → yutipy-1.5.2}/docs/requirements.txt +0 -0
  37. {yutipy-1.5.0 → yutipy-1.5.2}/docs/usage_examples.rst +0 -0
  38. {yutipy-1.5.0 → yutipy-1.5.2}/pyproject.toml +0 -0
  39. {yutipy-1.5.0 → yutipy-1.5.2}/requirements-dev.txt +0 -0
  40. {yutipy-1.5.0 → yutipy-1.5.2}/requirements.txt +0 -0
  41. {yutipy-1.5.0 → yutipy-1.5.2}/setup.cfg +0 -0
  42. {yutipy-1.5.0 → yutipy-1.5.2}/tests/__init__.py +0 -0
  43. {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_deezer.py +0 -0
  44. {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_itunes.py +0 -0
  45. {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_kkbox.py +0 -0
  46. {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_models.py +0 -0
  47. {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_musicyt.py +0 -0
  48. {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_spotify.py +0 -0
  49. {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_utils.py +0 -0
  50. {yutipy-1.5.0 → yutipy-1.5.2}/tests/test_yutipy_music.py +0 -0
  51. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/cli/__init__.py +0 -0
  52. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/cli/config.py +0 -0
  53. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/cli/search.py +0 -0
  54. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/models.py +0 -0
  55. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/utils/helpers.py +0 -0
  56. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy/utils/logger.py +0 -0
  57. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/dependency_links.txt +0 -0
  58. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/entry_points.txt +0 -0
  59. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/requires.txt +0 -0
  60. {yutipy-1.5.0 → yutipy-1.5.2}/yutipy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yutipy
3
- Version: 1.5.0
3
+ Version: 1.5.2
4
4
  Summary: A simple package for retrieving music information from various music platforms APIs.
5
5
  Author: Cheap Nightbot
6
6
  Author-email: Cheap Nightbot <hi@cheapnightbot.slmail.me>
@@ -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
- "exceptions"
16
+ "enable_logging",
17
+ "disable_logging",
17
18
  ]
@@ -1,3 +1,5 @@
1
+ __all__ = ["Deezer", "DeezerException"]
2
+
1
3
  from pprint import pprint
2
4
  from typing import Dict, List, Optional
3
5
 
@@ -1,15 +1,20 @@
1
- class YutipyException(Exception):
2
- """Base class for exceptions in the Yutipy package."""
3
-
4
- pass
1
+ __all__ = [
2
+ "AuthenticationException",
3
+ "InvalidResponseException",
4
+ "InvalidValueException",
5
+ "NetworkException",
6
+ "YutipyException",
7
+ ]
5
8
 
6
9
 
7
- class InvalidValueException(YutipyException):
8
- """Exception raised for invalid values."""
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 SpotifyException(YutipyException):
26
- """Exception raised for errors related to the Spotify API."""
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 AuthenticationException(YutipyException):
38
- """Exception raised for authentication errors."""
42
+ class SpotifyException(YutipyException):
43
+ """Exception raised for errors related to the Spotify API."""
39
44
 
40
45
  pass
41
46
 
42
47
 
43
- class NetworkException(YutipyException):
44
- """Exception raised for network-related errors."""
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 KKBoxException(YutipyException):
56
- """Exception raised for erros related to the KKBOX Open API."""
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,3 +1,5 @@
1
+ __all__ = ["Itunes", "ItunesException"]
2
+
1
3
  from datetime import datetime
2
4
  from pprint import pprint
3
5
  from typing import Dict, Optional
@@ -1,3 +1,5 @@
1
+ __all__ = ["KKBox", "KKBoxException"]
2
+
1
3
  import base64
2
4
  import os
3
5
  import time
@@ -1,4 +1,5 @@
1
- import os
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
- NetworkException,
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"Network error while searching YouTube Music: {e}")
90
- raise NetworkException(f"Network error occurred: {e}")
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 .env file.
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 .env file.
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, Exception) as e:
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, Exception) as e:
46
+ except (SpotifyException) as e:
47
47
  logger.warning(
48
48
  f"{self.__class__.__name__}: Skipping Spotify due to SpotifyException: {e}"
49
49
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yutipy
3
- Version: 1.5.0
3
+ Version: 1.5.2
4
4
  Summary: A simple package for retrieving music information from various music platforms APIs.
5
5
  Author: Cheap Nightbot
6
6
  Author-email: Cheap Nightbot <hi@cheapnightbot.slmail.me>
@@ -39,7 +39,6 @@ yutipy/deezer.py
39
39
  yutipy/exceptions.py
40
40
  yutipy/itunes.py
41
41
  yutipy/kkbox.py
42
- yutipy/logging.py
43
42
  yutipy/models.py
44
43
  yutipy/musicyt.py
45
44
  yutipy/spotify.py
@@ -1,3 +0,0 @@
1
- from .utils.logger import enable_logging, disable_logging
2
-
3
- __all__ = ["enable_logging", "disable_logging"]
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