yutipy 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

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/__init__.py CHANGED
@@ -2,12 +2,12 @@ from .deezer import Deezer
2
2
  from .itunes import Itunes
3
3
  from .models import MusicInfo
4
4
  from .musicyt import MusicYT
5
- from .spotify import Spotipy
5
+ from .spotify import Spotify
6
6
 
7
7
  __all__ = [
8
8
  "Deezer",
9
9
  "Itunes",
10
10
  "MusicInfo",
11
11
  "MusicYT",
12
- "Spotipy",
12
+ "Spotify",
13
13
  ]
Binary file
Binary file
Binary file
Binary file
Binary file
yutipy/deezer.py CHANGED
@@ -30,7 +30,7 @@ class Deezer:
30
30
  """Exits the runtime context related to this object."""
31
31
  self._close_session()
32
32
 
33
- def _close_session(self) -> None:
33
+ def close_session(self) -> None:
34
34
  """Closes the current session."""
35
35
  if not self.is_session_closed:
36
36
  self._session.close()
@@ -54,7 +54,7 @@ class Deezer:
54
54
 
55
55
  Returns
56
56
  -------
57
- Optional[MusicInfo]
57
+ Optional[MusicInfo_]
58
58
  The music information if found, otherwise None.
59
59
  """
60
60
  if not is_valid_string(artist) or not is_valid_string(song):
@@ -104,13 +104,12 @@ class Deezer:
104
104
  Optional[Dict]
105
105
  A dictionary containing UPC and ISRC information.
106
106
  """
107
- match music_type:
108
- case "track":
109
- return self._get_track_info(music_id)
110
- case "album":
111
- return self._get_album_info(music_id)
112
- case _:
113
- raise DeezerException(f"Invalid music type: {music_type}")
107
+ if music_type == "track":
108
+ return self._get_track_info(music_id)
109
+ elif music_type == "album":
110
+ return self._get_album_info(music_id)
111
+ else:
112
+ raise DeezerException(f"Invalid music type: {music_type}")
114
113
 
115
114
  def _get_track_info(self, music_id: int) -> Optional[Dict]:
116
115
  """
yutipy/itunes.py CHANGED
@@ -31,7 +31,7 @@ class Itunes:
31
31
  """Exits the runtime context related to this object."""
32
32
  self._close_session()
33
33
 
34
- def _close_session(self) -> None:
34
+ def close_session(self) -> None:
35
35
  """Closes the current session."""
36
36
  if not self.is_session_closed:
37
37
  self._session.close()
@@ -55,7 +55,7 @@ class Itunes:
55
55
 
56
56
  Returns
57
57
  -------
58
- Optional[MusicInfo]
58
+ Optional[MusicInfo_]
59
59
  The music information if found, otherwise None.
60
60
  """
61
61
  if not is_valid_string(artist) or not is_valid_string(song):
yutipy/musicyt.py CHANGED
@@ -33,7 +33,7 @@ class MusicYT:
33
33
 
34
34
  Returns
35
35
  -------
36
- Optional[MusicInfo]
36
+ Optional[MusicInfo_]
37
37
  The music information if found, otherwise None.
38
38
  """
39
39
  if not is_valid_string(artist) or not is_valid_string(song):
yutipy/spotify.py CHANGED
@@ -2,7 +2,7 @@ import base64
2
2
  import os
3
3
  import time
4
4
  from pprint import pprint
5
- from typing import Optional
5
+ from typing import Optional, Union
6
6
 
7
7
  import requests
8
8
  from dotenv import load_dotenv
@@ -27,11 +27,11 @@ CLIENT_ID = os.getenv("CLIENT_ID")
27
27
  CLIENT_SECRET = os.getenv("CLIENT_SECRET")
28
28
 
29
29
 
30
- class Spotipy:
30
+ class Spotify:
31
31
  """
32
32
  A class to interact with the Spotify API.
33
33
 
34
- This class reads the CLIENT_ID and CLIENT_SECRET from the .env file by default.
34
+ This class reads the ``CLIENT_ID`` and ``CLIENT_SECRET`` from environment variables or the ``.env`` file by default.
35
35
  Alternatively, users can manually provide these values when creating an object.
36
36
  """
37
37
 
@@ -39,7 +39,7 @@ class Spotipy:
39
39
  self, client_id: str = CLIENT_ID, client_secret: str = CLIENT_SECRET
40
40
  ) -> None:
41
41
  """
42
- Initializes the Spotipy class and sets up the session.
42
+ Initializes the Spotify class and sets up the session.
43
43
 
44
44
  Parameters
45
45
  ----------
@@ -69,7 +69,7 @@ class Spotipy:
69
69
  """Exits the runtime context related to this object."""
70
70
  self._close_session()
71
71
 
72
- def _close_session(self) -> None:
72
+ def close_session(self) -> None:
73
73
  """Closes the current session."""
74
74
  if not self.is_session_closed:
75
75
  self._session.close()
@@ -147,7 +147,7 @@ class Spotipy:
147
147
 
148
148
  Returns
149
149
  -------
150
- Optional[MusicInfo]
150
+ Optional[MusicInfo_]
151
151
  The music information if found, otherwise None.
152
152
  """
153
153
  if not is_valid_string(artist) or not is_valid_string(song):
@@ -192,7 +192,7 @@ class Spotipy:
192
192
 
193
193
  Returns
194
194
  -------
195
- Optional[MusicInfo]
195
+ Optional[MusicInfo_]
196
196
  The music information if found, otherwise None.
197
197
  """
198
198
  if not is_valid_string(artist) or not is_valid_string(song):
@@ -224,7 +224,7 @@ class Spotipy:
224
224
  artist_ids = self._get_artists_ids(artist)
225
225
  return self._find_music_info(artist, song, response.json(), artist_ids)
226
226
 
227
- def _get_artists_ids(self, artist: str) -> list | None:
227
+ def _get_artists_ids(self, artist: str) -> Union[list, None]:
228
228
  """
229
229
  Retrieves the IDs of the artists.
230
230
 
@@ -235,7 +235,7 @@ class Spotipy:
235
235
 
236
236
  Returns
237
237
  -------
238
- list | None
238
+ Union[list, None]
239
239
  A list of artist IDs or None if not found.
240
240
  """
241
241
  artist_ids = []
@@ -403,11 +403,11 @@ class Spotipy:
403
403
 
404
404
 
405
405
  if __name__ == "__main__":
406
- spotipy = Spotipy(CLIENT_ID, CLIENT_SECRET)
406
+ Spotify = Spotify(CLIENT_ID, CLIENT_SECRET)
407
407
 
408
408
  try:
409
409
  artist_name = input("Artist Name: ")
410
410
  song_name = input("Song Name: ")
411
- pprint(spotipy.search(artist_name, song_name))
411
+ pprint(Spotify.search(artist_name, song_name))
412
412
  finally:
413
- spotipy._close_session()
413
+ Spotify._close_session()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: yutipy
3
- Version: 0.1.0
3
+ Version: 0.1.1
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>
@@ -53,13 +53,34 @@ Requires-Dist: rapidfuzz==3.12.1
53
53
  Requires-Dist: requests==2.32.3
54
54
  Requires-Dist: ytmusicapi==1.10.1
55
55
  Provides-Extra: dev
56
- Requires-Dist: pytest==8.3.4; extra == "dev"
57
- Requires-Dist: Sphinx==8.2.0; extra == "dev"
56
+ Requires-Dist: pytest; extra == "dev"
58
57
 
59
58
  <p align="center">
60
59
  <img src="https://raw.githubusercontent.com/CheapNightbot/yutipy/main/docs/_static/yutipy_header.png" alt="yutipy" />
61
60
  </p>
62
61
 
62
+ <p align="center">
63
+ <a href="https://github.com/CheapNightbot/yutipy/actions/workflows/tests.yml">
64
+ <img alt="GitHub Actions Workflow Status" src="https://img.shields.io/github/actions/workflow/status/cheapnightbot/yutipy/pytest-unit-testing.yml?style=for-the-badge&label=Pytest">
65
+ </a>
66
+
67
+ <a href="https://pypi.org/project/yutipy/">
68
+ <img src="https://img.shields.io/pypi/v/yutipy?style=for-the-badge" alt="PyPI" />
69
+ </a>
70
+ <a href="https://yutipy.readthedocs.io/en/latest/">
71
+ <img src="https://img.shields.io/readthedocs/yutipy?style=for-the-badge" alt="Documentation Status" />
72
+ </a>
73
+ <a href="https://github.com/CheapNightbot/yutipy/blob/master/LICENSE">
74
+ <img src="https://img.shields.io/github/license/CheapNightbot/yutipy?style=for-the-badge" alt="License" />
75
+ </a>
76
+ <a href="https://github.com/CheapNightbot/yutipy/stargazers">
77
+ <img src="https://img.shields.io/github/stars/CheapNightbot/yutipy?style=for-the-badge" alt="Stars" />
78
+ </a>
79
+ <a href="https://github.com/CheapNightbot/yutipy/issues">
80
+ <img src="https://img.shields.io/github/issues/CheapNightbot/yutipy?style=for-the-badge" alt="Issues" />
81
+ </a>
82
+ </p>
83
+
63
84
  A _**simple**_ Python package for searching and retrieving music information from various music platforms APIs, including Deezer, iTunes, Spotify, and YouTube Music.
64
85
 
65
86
  ## Table of Contents
@@ -98,7 +119,7 @@ with Deezer() as deezer:
98
119
  print(result)
99
120
  ```
100
121
 
101
- For more usage examples, see the [docs](#).
122
+ For more usage examples, see the [Usage Examples](https://yutipy.readthedocs.io/en/latest/usage_examples.html) page in docs.
102
123
 
103
124
  ## Contributing
104
125
 
@@ -0,0 +1,23 @@
1
+ yutipy/__init__.py,sha256=t0w-pRLjIGD3UtDyd-JpeL-RrMona7YTV_0lZCpGLEc,232
2
+ yutipy/deezer.py,sha256=TbPk6f1ytrtk9GHXOoRZ948fcgOi0619-rQC9xfTYu0,8641
3
+ yutipy/exceptions.py,sha256=QDfOkaeZtSNg1lhXZ872yNJwbof68eVHDezZeZh8DiU,1029
4
+ yutipy/itunes.py,sha256=NhrllA3U0PUY3dNoMyiG1oZuyvdMQKYRBHzYSkt8ikM,5843
5
+ yutipy/models.py,sha256=-UEi05on5XsKjFSqUNt1yZnLod_A9upqh2nIPWTtEEI,1415
6
+ yutipy/musicyt.py,sha256=kvRYuhlNVuvy-WahJq895T3JAzmGTTiKB89r_uTMTAI,7155
7
+ yutipy/spotify.py,sha256=YYTF1git7mRVFWWGM1TILIIyZMPPDbD_F_BLjfqU6cI,12906
8
+ yutipy/__pycache__/__init__.cpython-312.pyc,sha256=q-CaghM107NTOH0ZfH9LKDDUZJuGA_teF1QyoO1wNb8,392
9
+ yutipy/__pycache__/deezer.cpython-312.pyc,sha256=UfRxyBobsocMxkpF4HP06EpFsAz96ZHU4QlYn8EzQcY,10588
10
+ yutipy/__pycache__/exceptions.cpython-312.pyc,sha256=Zc73Tr79emWJ9pmpAVoL12YnBBOWJulV1hxtSso4hy8,2096
11
+ yutipy/__pycache__/itunes.cpython-312.pyc,sha256=59fJpxL2ZjQoyzq_1U6sesJEuNrfa62kvtPYeSwzZNg,7521
12
+ yutipy/__pycache__/models.cpython-312.pyc,sha256=KJUa3-C67TMq1EAGuQlZYT99JS1AEDUi74KY8bEHkkg,1848
13
+ yutipy/__pycache__/musicyt.cpython-312.pyc,sha256=y508WR8Cl8DtisJli3FwNDEC6CJZajiZdcWJLN7xXyY,9176
14
+ yutipy/__pycache__/spotify.cpython-312.pyc,sha256=0Knor0AN6zG6ATYSGL0YPb6b7rrT2krnpBv-e2ynam8,15870
15
+ yutipy/utils/__init__.py,sha256=7UFcFZ7fBtNXOTngjnRD3MeobT3x5UT2Gag94TXVgLk,169
16
+ yutipy/utils/cheap_utils.py,sha256=LIuEHib_97NuLahXxdHJUD9v-ccXNUc3NrLYk8EQ52A,1652
17
+ yutipy/utils/__pycache__/__init__.cpython-312.pyc,sha256=_ldEMv66ELlrY1M7fN_2r5XySvgAsqTE0U8ASGXx8bs,286
18
+ yutipy/utils/__pycache__/cheap_utils.cpython-312.pyc,sha256=i6nRmXcRtCkTzKQ1mWyjN7Xz4NapqgBdXA33so8xgLU,2376
19
+ yutipy-0.1.1.dist-info/LICENSE,sha256=Tymbhvk1F_6BDFE0X8BBiQp7cBCjbzKfRAITmvxJIyA,1092
20
+ yutipy-0.1.1.dist-info/METADATA,sha256=nWGLHD2t-1GvvU9vUXcU5TtvLe05_w2G0U8pKhWw_Uc,5865
21
+ yutipy-0.1.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
22
+ yutipy-0.1.1.dist-info/top_level.txt,sha256=t2A5V2_mUcfnHkbCy6tAQlb3909jDYU5GQgXtA4756I,7
23
+ yutipy-0.1.1.dist-info/RECORD,,
@@ -1,23 +0,0 @@
1
- yutipy/__init__.py,sha256=GKMg-aksc_2IAjcKAogGCe_aeSstuwAexjVdJRPS0mE,232
2
- yutipy/deezer.py,sha256=h2ZeOyzS0L0--qmowkNsFXUl0Nbk30x447bapTV10Io,8667
3
- yutipy/exceptions.py,sha256=QDfOkaeZtSNg1lhXZ872yNJwbof68eVHDezZeZh8DiU,1029
4
- yutipy/itunes.py,sha256=NiRGCgV5EASjkS_FPhzDwOq8oge-AeDwkVK4JHNy698,5843
5
- yutipy/models.py,sha256=-UEi05on5XsKjFSqUNt1yZnLod_A9upqh2nIPWTtEEI,1415
6
- yutipy/musicyt.py,sha256=fVhCFZUgv34CjyDRMIBeLNYsEuTgENxyMlGUt9Uf1JA,7154
7
- yutipy/spotify.py,sha256=X8-jDFj8U5kY4zeuGoZ-hrgDbzbKKww47vpVvJev1rA,12849
8
- yutipy/__pycache__/__init__.cpython-312.pyc,sha256=hnQz69yUeXB3mK1j0EiIsKfFRm1ywiQF170VggBhjdc,392
9
- yutipy/__pycache__/deezer.cpython-312.pyc,sha256=w5LdiOePHf0NLLDQfj__FxsuplJ4dN5JLnCAK0MXD9I,10578
10
- yutipy/__pycache__/exceptions.cpython-312.pyc,sha256=Zc73Tr79emWJ9pmpAVoL12YnBBOWJulV1hxtSso4hy8,2096
11
- yutipy/__pycache__/itunes.cpython-312.pyc,sha256=PvXlgEp6uWzAR_VlPYP-bmQQPmkURz2237AOgFiD5o4,7511
12
- yutipy/__pycache__/models.cpython-312.pyc,sha256=KJUa3-C67TMq1EAGuQlZYT99JS1AEDUi74KY8bEHkkg,1848
13
- yutipy/__pycache__/musicyt.cpython-312.pyc,sha256=494-Q64MEXVwsRSZycCCp6T-h37y0RAARnv_OA2QZ-0,9175
14
- yutipy/__pycache__/spotify.cpython-312.pyc,sha256=P5UXhd8g0h9EaxfPaPyQUeIIHHqLmQCcAXfJcTTKzsI,15789
15
- yutipy/utils/__init__.py,sha256=7UFcFZ7fBtNXOTngjnRD3MeobT3x5UT2Gag94TXVgLk,169
16
- yutipy/utils/cheap_utils.py,sha256=LIuEHib_97NuLahXxdHJUD9v-ccXNUc3NrLYk8EQ52A,1652
17
- yutipy/utils/__pycache__/__init__.cpython-312.pyc,sha256=_ldEMv66ELlrY1M7fN_2r5XySvgAsqTE0U8ASGXx8bs,286
18
- yutipy/utils/__pycache__/cheap_utils.cpython-312.pyc,sha256=i6nRmXcRtCkTzKQ1mWyjN7Xz4NapqgBdXA33so8xgLU,2376
19
- yutipy-0.1.0.dist-info/LICENSE,sha256=Tymbhvk1F_6BDFE0X8BBiQp7cBCjbzKfRAITmvxJIyA,1092
20
- yutipy-0.1.0.dist-info/METADATA,sha256=krlRAHqZqAowrWiRymP1L5pyC5IgHht8BVpQTz01qMs,4708
21
- yutipy-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
22
- yutipy-0.1.0.dist-info/top_level.txt,sha256=t2A5V2_mUcfnHkbCy6tAQlb3909jDYU5GQgXtA4756I,7
23
- yutipy-0.1.0.dist-info/RECORD,,
File without changes