yutipy 2.3.3__tar.gz → 2.3.5__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.
Files changed (64) hide show
  1. {yutipy-2.3.3 → yutipy-2.3.5}/PKG-INFO +2 -2
  2. {yutipy-2.3.3 → yutipy-2.3.5}/pyproject.toml +1 -1
  3. {yutipy-2.3.3 → yutipy-2.3.5}/requirements.txt +1 -1
  4. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/base_clients.py +2 -0
  5. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/utils/helpers.py +3 -3
  6. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/yutipy_music.py +28 -13
  7. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy.egg-info/PKG-INFO +2 -2
  8. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy.egg-info/requires.txt +1 -1
  9. {yutipy-2.3.3 → yutipy-2.3.5}/.gitattributes +0 -0
  10. {yutipy-2.3.3 → yutipy-2.3.5}/.github/FUNDING.yml +0 -0
  11. {yutipy-2.3.3 → yutipy-2.3.5}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  12. {yutipy-2.3.3 → yutipy-2.3.5}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  13. {yutipy-2.3.3 → yutipy-2.3.5}/.github/dependabot.yml +0 -0
  14. {yutipy-2.3.3 → yutipy-2.3.5}/.github/workflows/pytest-unit-testing.yml +0 -0
  15. {yutipy-2.3.3 → yutipy-2.3.5}/.github/workflows/release.yml +0 -0
  16. {yutipy-2.3.3 → yutipy-2.3.5}/.gitignore +0 -0
  17. {yutipy-2.3.3 → yutipy-2.3.5}/.readthedocs.yaml +0 -0
  18. {yutipy-2.3.3 → yutipy-2.3.5}/LICENSE +0 -0
  19. {yutipy-2.3.3 → yutipy-2.3.5}/MANIFEST.in +0 -0
  20. {yutipy-2.3.3 → yutipy-2.3.5}/README.md +0 -0
  21. {yutipy-2.3.3 → yutipy-2.3.5}/docs/Makefile +0 -0
  22. {yutipy-2.3.3 → yutipy-2.3.5}/docs/_static/yutipy_header.png +0 -0
  23. {yutipy-2.3.3 → yutipy-2.3.5}/docs/_static/yutipy_logo.png +0 -0
  24. {yutipy-2.3.3 → yutipy-2.3.5}/docs/api_reference.rst +0 -0
  25. {yutipy-2.3.3 → yutipy-2.3.5}/docs/available_platforms.rst +0 -0
  26. {yutipy-2.3.3 → yutipy-2.3.5}/docs/cli.rst +0 -0
  27. {yutipy-2.3.3 → yutipy-2.3.5}/docs/conf.py +0 -0
  28. {yutipy-2.3.3 → yutipy-2.3.5}/docs/faq.rst +0 -0
  29. {yutipy-2.3.3 → yutipy-2.3.5}/docs/index.rst +0 -0
  30. {yutipy-2.3.3 → yutipy-2.3.5}/docs/installation.rst +0 -0
  31. {yutipy-2.3.3 → yutipy-2.3.5}/docs/make.bat +0 -0
  32. {yutipy-2.3.3 → yutipy-2.3.5}/docs/requirements.txt +0 -0
  33. {yutipy-2.3.3 → yutipy-2.3.5}/docs/usage_examples.rst +0 -0
  34. {yutipy-2.3.3 → yutipy-2.3.5}/requirements-dev.txt +0 -0
  35. {yutipy-2.3.3 → yutipy-2.3.5}/setup.cfg +0 -0
  36. {yutipy-2.3.3 → yutipy-2.3.5}/tests/__init__.py +0 -0
  37. {yutipy-2.3.3 → yutipy-2.3.5}/tests/test_deezer.py +0 -0
  38. {yutipy-2.3.3 → yutipy-2.3.5}/tests/test_itunes.py +0 -0
  39. {yutipy-2.3.3 → yutipy-2.3.5}/tests/test_kkbox.py +0 -0
  40. {yutipy-2.3.3 → yutipy-2.3.5}/tests/test_lastfm.py +0 -0
  41. {yutipy-2.3.3 → yutipy-2.3.5}/tests/test_lrclib.py +0 -0
  42. {yutipy-2.3.3 → yutipy-2.3.5}/tests/test_models.py +0 -0
  43. {yutipy-2.3.3 → yutipy-2.3.5}/tests/test_musicyt.py +0 -0
  44. {yutipy-2.3.3 → yutipy-2.3.5}/tests/test_spotify.py +0 -0
  45. {yutipy-2.3.3 → yutipy-2.3.5}/tests/test_utils.py +0 -0
  46. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/__init__.py +0 -0
  47. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/cli/__init__.py +0 -0
  48. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/cli/config.py +0 -0
  49. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/cli/search.py +0 -0
  50. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/deezer.py +0 -0
  51. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/exceptions.py +0 -0
  52. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/itunes.py +0 -0
  53. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/kkbox.py +0 -0
  54. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/lastfm.py +0 -0
  55. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/logger.py +0 -0
  56. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/lrclib.py +0 -0
  57. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/models.py +0 -0
  58. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/musicyt.py +0 -0
  59. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/spotify.py +0 -0
  60. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy/utils/__init__.py +0 -0
  61. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy.egg-info/SOURCES.txt +0 -0
  62. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy.egg-info/dependency_links.txt +0 -0
  63. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy.egg-info/entry_points.txt +0 -0
  64. {yutipy-2.3.3 → yutipy-2.3.5}/yutipy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yutipy
3
- Version: 2.3.3
3
+ Version: 2.3.5
4
4
  Summary: A simple Python package to interact with various music platforms APIs.
5
5
  Author: Cheap Nightbot
6
6
  Author-email: Cheap Nightbot <hi@cheapnightbot.slmail.me>
@@ -26,7 +26,7 @@ Requires-Python: >=3.9
26
26
  Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
28
  Requires-Dist: pykakasi==2.3.0
29
- Requires-Dist: python-dotenv==1.1.0
29
+ Requires-Dist: python-dotenv==1.1.1
30
30
  Requires-Dist: rapidfuzz==3.13.0
31
31
  Requires-Dist: requests==2.32.4
32
32
  Requires-Dist: ytmusicapi==1.10.3
@@ -7,7 +7,7 @@ name = "yutipy"
7
7
  dynamic = ["version"]
8
8
  dependencies = [
9
9
  "pykakasi==2.3.0",
10
- "python-dotenv==1.1.0",
10
+ "python-dotenv==1.1.1",
11
11
  "rapidfuzz==3.13.0",
12
12
  "requests==2.32.4",
13
13
  "ytmusicapi==1.10.3",
@@ -1,5 +1,5 @@
1
1
  pykakasi==2.3.0
2
- python-dotenv==1.1.0
2
+ python-dotenv==1.1.1
3
3
  RapidFuzz==3.13.0
4
4
  requests==2.32.4
5
5
  ytmusicapi==1.10.3
@@ -404,6 +404,8 @@ class BaseAuthClient:
404
404
  )
405
405
 
406
406
  response_json = response.json()
407
+ if "refresh_token" not in response_json:
408
+ response_json["refresh_token"] = refresh_token
407
409
  response_json["requested_at"] = time()
408
410
  return response_json
409
411
 
@@ -10,9 +10,9 @@ kakasi = pykakasi.kakasi()
10
10
  TRANSLATION_CACHE = {}
11
11
 
12
12
 
13
- def similarity(str1: str, str2: str, threshold: int = 80):
13
+ def similarity(str1: str, str2: str, threshold: int = 100):
14
14
  similarity_score = fuzz.WRatio(str1, str2, processor=default_process)
15
- return similarity_score > threshold
15
+ return similarity_score >= threshold
16
16
 
17
17
 
18
18
  def translate_text(
@@ -66,7 +66,7 @@ def translate_text(
66
66
  def are_strings_similar(
67
67
  str1: str,
68
68
  str2: str,
69
- threshold: int = 80,
69
+ threshold: int = 90,
70
70
  use_translation: bool = True,
71
71
  translation_session: requests.Session = None,
72
72
  ) -> bool:
@@ -25,8 +25,8 @@ class YutipyMusic:
25
25
 
26
26
  def __init__(
27
27
  self,
28
- custom_kkbox_class=KKBox,
29
- custom_spotify_class=Spotify,
28
+ custom_kkbox_class=None,
29
+ custom_spotify_class=None,
30
30
  ) -> None:
31
31
  """
32
32
  Parameters
@@ -48,8 +48,10 @@ class YutipyMusic:
48
48
  }
49
49
 
50
50
  try:
51
- self.services["kkbox"] = custom_kkbox_class(
52
- defer_load=True, fetch_lyrics=False
51
+ self.services["kkbox"] = (
52
+ custom_kkbox_class(defer_load=True, fetch_lyrics=False)
53
+ if custom_kkbox_class
54
+ else KKBox(fetch_lyrics=False)
53
55
  )
54
56
  except KKBoxException as e:
55
57
  logger.warning(
@@ -60,8 +62,10 @@ class YutipyMusic:
60
62
  self.album_art_priority.insert(idx, "kkbox")
61
63
 
62
64
  try:
63
- self.services["spotify"] = custom_spotify_class(
64
- defer_load=True, fetch_lyrics=False
65
+ self.services["spotify"] = (
66
+ custom_spotify_class(defer_load=True, fetch_lyrics=False)
67
+ if custom_spotify_class
68
+ else Spotify(fetch_lyrics=False)
65
69
  )
66
70
  except SpotifyException as e:
67
71
  logger.warning(
@@ -179,12 +183,23 @@ class YutipyMusic:
179
183
  "upc",
180
184
  ]
181
185
 
182
- for attr in attributes:
183
- if getattr(result, attr) and (
184
- not getattr(self.music_info, attr)
185
- or (attr in ["genre", "album_type"] and service_name == "itunes")
186
- ):
186
+ # Always overwrite with Spotify, else Deezer, else KKBox
187
+ highest_priority = None
188
+ for candidate in ["spotify", "deezer", "kkbox"]:
189
+ if candidate in self.services:
190
+ highest_priority = candidate
191
+ break
192
+
193
+ if service_name == highest_priority:
194
+ for attr in attributes:
187
195
  setattr(self.music_info, attr, getattr(result, attr))
196
+ else:
197
+ for attr in attributes:
198
+ if getattr(result, attr) and (
199
+ not getattr(self.music_info, attr)
200
+ or (attr in ["genre", "album_type"] and service_name == "itunes")
201
+ ):
202
+ setattr(self.music_info, attr, getattr(result, attr))
188
203
 
189
204
  if result.album_art:
190
205
  current_priority = self.album_art_priority.index(service_name)
@@ -193,7 +208,7 @@ class YutipyMusic:
193
208
  if self.music_info.album_art_source
194
209
  else len(self.album_art_priority)
195
210
  )
196
- if current_priority < existing_priority:
211
+ if current_priority < existing_priority or service_name == highest_priority:
197
212
  self.music_info.album_art = result.album_art
198
213
  self.music_info.album_art_source = service_name
199
214
 
@@ -213,7 +228,7 @@ if __name__ == "__main__":
213
228
 
214
229
  from yutipy.logger import enable_logging
215
230
 
216
- enable_logging(level=logging.DEBUG)
231
+ enable_logging(level=logging.INFO)
217
232
  yutipy_music = YutipyMusic()
218
233
 
219
234
  artist_name = input("Artist Name: ")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yutipy
3
- Version: 2.3.3
3
+ Version: 2.3.5
4
4
  Summary: A simple Python package to interact with various music platforms APIs.
5
5
  Author: Cheap Nightbot
6
6
  Author-email: Cheap Nightbot <hi@cheapnightbot.slmail.me>
@@ -26,7 +26,7 @@ Requires-Python: >=3.9
26
26
  Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
28
  Requires-Dist: pykakasi==2.3.0
29
- Requires-Dist: python-dotenv==1.1.0
29
+ Requires-Dist: python-dotenv==1.1.1
30
30
  Requires-Dist: rapidfuzz==3.13.0
31
31
  Requires-Dist: requests==2.32.4
32
32
  Requires-Dist: ytmusicapi==1.10.3
@@ -1,5 +1,5 @@
1
1
  pykakasi==2.3.0
2
- python-dotenv==1.1.0
2
+ python-dotenv==1.1.1
3
3
  rapidfuzz==3.13.0
4
4
  requests==2.32.4
5
5
  ytmusicapi==1.10.3
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