yutipy 1.4.0__tar.gz → 1.4.1__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 (56) hide show
  1. {yutipy-1.4.0 → yutipy-1.4.1}/.github/workflows/release.yml +0 -14
  2. {yutipy-1.4.0 → yutipy-1.4.1}/PKG-INFO +2 -2
  3. {yutipy-1.4.0 → yutipy-1.4.1}/pyproject.toml +1 -1
  4. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/__init__.py +2 -0
  5. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/spotify.py +10 -3
  6. yutipy-1.4.1/yutipy/utils/__init__.py +13 -0
  7. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/utils/cheap_utils.py +10 -0
  8. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/yutipy_music.py +25 -18
  9. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy.egg-info/PKG-INFO +2 -2
  10. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy.egg-info/SOURCES.txt +0 -1
  11. yutipy-1.4.0/.github/release-drafter.yml +0 -16
  12. yutipy-1.4.0/yutipy/utils/__init__.py +0 -7
  13. {yutipy-1.4.0 → yutipy-1.4.1}/.gitattributes +0 -0
  14. {yutipy-1.4.0 → yutipy-1.4.1}/.github/FUNDING.yml +0 -0
  15. {yutipy-1.4.0 → yutipy-1.4.1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  16. {yutipy-1.4.0 → yutipy-1.4.1}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  17. {yutipy-1.4.0 → yutipy-1.4.1}/.github/workflows/pytest-unit-testing.yml +0 -0
  18. {yutipy-1.4.0 → yutipy-1.4.1}/.gitignore +0 -0
  19. {yutipy-1.4.0 → yutipy-1.4.1}/.readthedocs.yaml +0 -0
  20. {yutipy-1.4.0 → yutipy-1.4.1}/LICENSE +0 -0
  21. {yutipy-1.4.0 → yutipy-1.4.1}/MANIFEST.in +0 -0
  22. {yutipy-1.4.0 → yutipy-1.4.1}/README.md +0 -0
  23. {yutipy-1.4.0 → yutipy-1.4.1}/docs/Makefile +0 -0
  24. {yutipy-1.4.0 → yutipy-1.4.1}/docs/_static/yutipy_header.png +0 -0
  25. {yutipy-1.4.0 → yutipy-1.4.1}/docs/_static/yutipy_logo.png +0 -0
  26. {yutipy-1.4.0 → yutipy-1.4.1}/docs/api_reference.rst +0 -0
  27. {yutipy-1.4.0 → yutipy-1.4.1}/docs/available_platforms.rst +0 -0
  28. {yutipy-1.4.0 → yutipy-1.4.1}/docs/conf.py +0 -0
  29. {yutipy-1.4.0 → yutipy-1.4.1}/docs/faq.rst +0 -0
  30. {yutipy-1.4.0 → yutipy-1.4.1}/docs/index.rst +0 -0
  31. {yutipy-1.4.0 → yutipy-1.4.1}/docs/installation.rst +0 -0
  32. {yutipy-1.4.0 → yutipy-1.4.1}/docs/make.bat +0 -0
  33. {yutipy-1.4.0 → yutipy-1.4.1}/docs/requirements.txt +0 -0
  34. {yutipy-1.4.0 → yutipy-1.4.1}/docs/usage_examples.rst +0 -0
  35. {yutipy-1.4.0 → yutipy-1.4.1}/requirements-dev.txt +0 -0
  36. {yutipy-1.4.0 → yutipy-1.4.1}/requirements.txt +0 -0
  37. {yutipy-1.4.0 → yutipy-1.4.1}/setup.cfg +0 -0
  38. {yutipy-1.4.0 → yutipy-1.4.1}/tests/__init__.py +0 -0
  39. {yutipy-1.4.0 → yutipy-1.4.1}/tests/test_deezer.py +0 -0
  40. {yutipy-1.4.0 → yutipy-1.4.1}/tests/test_itunes.py +0 -0
  41. {yutipy-1.4.0 → yutipy-1.4.1}/tests/test_kkbox.py +0 -0
  42. {yutipy-1.4.0 → yutipy-1.4.1}/tests/test_models.py +0 -0
  43. {yutipy-1.4.0 → yutipy-1.4.1}/tests/test_musicyt.py +0 -0
  44. {yutipy-1.4.0 → yutipy-1.4.1}/tests/test_spotify.py +0 -0
  45. {yutipy-1.4.0 → yutipy-1.4.1}/tests/test_utils.py +0 -0
  46. {yutipy-1.4.0 → yutipy-1.4.1}/tests/test_yutipy_music.py +0 -0
  47. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/deezer.py +0 -0
  48. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/exceptions.py +0 -0
  49. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/itunes.py +0 -0
  50. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/kkbox.py +0 -0
  51. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/models.py +0 -0
  52. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/musicyt.py +0 -0
  53. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy/utils/logger.py +0 -0
  54. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy.egg-info/dependency_links.txt +0 -0
  55. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy.egg-info/requires.txt +0 -0
  56. {yutipy-1.4.0 → yutipy-1.4.1}/yutipy.egg-info/top_level.txt +0 -0
@@ -54,25 +54,12 @@ jobs:
54
54
  path: dist/
55
55
  - name: Publish distribution 📦 to PyPI
56
56
  uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
57
- draft-release:
58
- name: Draft Release Notes
59
- runs-on: ubuntu-latest
60
- permissions:
61
- contents: read
62
- needs:
63
- - publish-to-pypi
64
- steps:
65
- - name: Draft Release Notes
66
- uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6.1.0
67
- with:
68
- config-name: .github/release-drafter.yml
69
57
  github-release:
70
58
  name: >-
71
59
  Sign the Python 🐍 distribution 📦 with Sigstore
72
60
  and upload them to GitHub Release
73
61
  needs:
74
62
  - publish-to-pypi
75
- - draft-release
76
63
  runs-on: ubuntu-latest
77
64
 
78
65
  permissions:
@@ -98,7 +85,6 @@ jobs:
98
85
  gh release create
99
86
  "$GITHUB_REF_NAME"
100
87
  --repo "$GITHUB_REPOSITORY"
101
- --notes-file .github/release-drafter.yml
102
88
  --generate-notes
103
89
  - name: Upload artifact signatures to GitHub Release
104
90
  env:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yutipy
3
- Version: 1.4.0
3
+ Version: 1.4.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>
@@ -33,7 +33,7 @@ Project-URL: Repository, https://github.com/CheapNightbot/yutipy.git
33
33
  Project-URL: Issues, https://github.com/CheapNightbot/yutipy/issues
34
34
  Project-URL: Changelog, https://github.com/CheapNightbot/yutipy/blob/master/CHANGELOG.md
35
35
  Project-URL: funding, https://ko-fi.com/cheapnightbot
36
- Keywords: music,API,Deezer,iTunes,Spotify,YouTube Music,search,retrieve,information,yutify
36
+ Keywords: music,API,Deezer,iTunes,Spotify,YouTube Music,search,retrieve,information,yutify,KKBox
37
37
  Classifier: Development Status :: 4 - Beta
38
38
  Classifier: Intended Audience :: Developers
39
39
  Classifier: Topic :: Software Development :: Libraries
@@ -22,7 +22,7 @@ maintainers = [
22
22
  description = "A simple package for retrieving music information from various music platforms APIs."
23
23
  readme = "README.md"
24
24
  license = {file = "LICENSE"}
25
- keywords = ["music", "API", "Deezer", "iTunes", "Spotify", "YouTube Music", "search", "retrieve", "information", "yutify"]
25
+ keywords = ["music", "API", "Deezer", "iTunes", "Spotify", "YouTube Music", "search", "retrieve", "information", "yutify", "KKBox"]
26
26
  classifiers = [
27
27
  "Development Status :: 4 - Beta",
28
28
  "Intended Audience :: Developers",
@@ -1,5 +1,6 @@
1
1
  from .deezer import Deezer
2
2
  from .itunes import Itunes
3
+ from .kkbox import KKBox
3
4
  from .models import MusicInfo
4
5
  from .musicyt import MusicYT
5
6
  from .spotify import Spotify
@@ -8,6 +9,7 @@ from .yutipy_music import YutipyMusic
8
9
  __all__ = [
9
10
  "Deezer",
10
11
  "Itunes",
12
+ "KKBox",
11
13
  "MusicInfo",
12
14
  "MusicYT",
13
15
  "Spotify",
@@ -16,6 +16,7 @@ from yutipy.exceptions import (
16
16
  )
17
17
  from yutipy.models import MusicInfo
18
18
  from yutipy.utils.cheap_utils import (
19
+ guess_album_type,
19
20
  are_strings_similar,
20
21
  is_valid_string,
21
22
  separate_artists,
@@ -175,6 +176,7 @@ class Spotify:
175
176
  self.normalize_non_english = normalize_non_english
176
177
 
177
178
  music_info = None
179
+ artist_ids = None
178
180
  queries = [
179
181
  f"?q=artist:{artist} track:{song}&type=track&limit={limit}",
180
182
  f"?q=artist:{artist} album:{song}&type=album&limit={limit}",
@@ -199,7 +201,7 @@ class Spotify:
199
201
  if response.status_code != 200:
200
202
  raise SpotifyException(f"Failed to search for music: {response.json()}")
201
203
 
202
- artist_ids = self._get_artists_ids(artist)
204
+ artist_ids = artist_ids if artist_ids else self._get_artists_ids(artist)
203
205
  music_info = self._find_music_info(
204
206
  artist, song, response.json(), artist_ids
205
207
  )
@@ -449,10 +451,15 @@ class Spotify:
449
451
  ]
450
452
 
451
453
  if matching_artists:
454
+ guess = guess_album_type(album.get("total_tracks", 1))
455
+ guessed_right = are_strings_similar(
456
+ album.get("album_type", "x"), guess, use_translation=False
457
+ )
458
+
452
459
  return MusicInfo(
453
460
  album_art=album["images"][0]["url"],
454
461
  album_title=album["name"],
455
- album_type=album["album_type"],
462
+ album_type=album.get("alnum_type") if guessed_right else guess,
456
463
  artists=", ".join(artists_name),
457
464
  genre=None,
458
465
  id=album["id"],
@@ -461,7 +468,7 @@ class Spotify:
461
468
  release_date=album["release_date"],
462
469
  tempo=None,
463
470
  title=album["name"],
464
- type="album",
471
+ type=album.get("type"),
465
472
  upc=None,
466
473
  url=album["external_urls"]["spotify"],
467
474
  )
@@ -0,0 +1,13 @@
1
+ from .cheap_utils import (
2
+ guess_album_type,
3
+ are_strings_similar,
4
+ is_valid_string,
5
+ separate_artists,
6
+ )
7
+
8
+ __all__ = [
9
+ "guess_album_type",
10
+ "are_strings_similar",
11
+ "is_valid_string",
12
+ "separate_artists",
13
+ ]
@@ -117,5 +117,15 @@ def is_valid_string(string: str) -> bool:
117
117
  return bool(string and (string.isalnum() or not string.isspace()))
118
118
 
119
119
 
120
+ def guess_album_type(total_tracks: int):
121
+ """Just guessing the album type (i.e. single, ep or album) by total track counts."""
122
+ if total_tracks == 1:
123
+ return "single"
124
+ if 3 <= total_tracks <= 5:
125
+ return "ep"
126
+ if total_tracks >= 7:
127
+ return "album"
128
+
129
+
120
130
  if __name__ == "__main__":
121
131
  separate_artists("Artist A ft. Artist B")
@@ -98,6 +98,20 @@ class YutipyMusic:
98
98
 
99
99
  self.normalize_non_english = normalize_non_english
100
100
 
101
+ attributes = [
102
+ "album_title",
103
+ "album_type",
104
+ "artists",
105
+ "genre",
106
+ "isrc",
107
+ "lyrics",
108
+ "release_date",
109
+ "tempo",
110
+ "title",
111
+ "type",
112
+ "upc",
113
+ ]
114
+
101
115
  with ThreadPoolExecutor() as executor:
102
116
  futures = {
103
117
  executor.submit(
@@ -113,14 +127,16 @@ class YutipyMusic:
113
127
  for future in as_completed(futures):
114
128
  service_name = futures[future]
115
129
  result = future.result()
116
- self._combine_results(result, service_name)
130
+ self._combine_results(result, service_name, attributes)
117
131
 
118
132
  if len(self.music_info.url) == 0:
119
133
  return None
120
134
 
121
135
  return self.music_info
122
136
 
123
- def _combine_results(self, result: Optional[MusicInfo], service_name: str) -> None:
137
+ def _combine_results(
138
+ self, result: Optional[MusicInfo], service_name: str, attributes: list
139
+ ) -> None:
124
140
  """
125
141
  Combines the results from different services.
126
142
 
@@ -134,25 +150,16 @@ class YutipyMusic:
134
150
  if not result:
135
151
  return
136
152
 
137
- attributes = [
138
- "album_title",
139
- "album_type",
140
- "artists",
141
- "genre",
142
- "isrc",
143
- "lyrics",
144
- "release_date",
145
- "tempo",
146
- "title",
147
- "type",
148
- "upc",
149
- ]
150
-
151
153
  for attr in attributes:
152
154
  if getattr(result, attr) and (
153
- not getattr(self.music_info, attr) or service_name == "spotify"
155
+ not getattr(self.music_info, attr)
156
+ or (attr in ["genre", "album_type"] and service_name == "itunes")
154
157
  ):
155
- setattr(self.music_info, attr, getattr(result, attr))
158
+ setattr(
159
+ self.music_info,
160
+ attr,
161
+ getattr(result, attributes.pop(attributes.index(attr))),
162
+ )
156
163
 
157
164
  if result.album_art:
158
165
  current_priority = self.album_art_priority.index(service_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: yutipy
3
- Version: 1.4.0
3
+ Version: 1.4.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>
@@ -33,7 +33,7 @@ Project-URL: Repository, https://github.com/CheapNightbot/yutipy.git
33
33
  Project-URL: Issues, https://github.com/CheapNightbot/yutipy/issues
34
34
  Project-URL: Changelog, https://github.com/CheapNightbot/yutipy/blob/master/CHANGELOG.md
35
35
  Project-URL: funding, https://ko-fi.com/cheapnightbot
36
- Keywords: music,API,Deezer,iTunes,Spotify,YouTube Music,search,retrieve,information,yutify
36
+ Keywords: music,API,Deezer,iTunes,Spotify,YouTube Music,search,retrieve,information,yutify,KKBox
37
37
  Classifier: Development Status :: 4 - Beta
38
38
  Classifier: Intended Audience :: Developers
39
39
  Classifier: Topic :: Software Development :: Libraries
@@ -8,7 +8,6 @@ pyproject.toml
8
8
  requirements-dev.txt
9
9
  requirements.txt
10
10
  .github/FUNDING.yml
11
- .github/release-drafter.yml
12
11
  .github/ISSUE_TEMPLATE/bug_report.md
13
12
  .github/ISSUE_TEMPLATE/feature_request.md
14
13
  .github/workflows/pytest-unit-testing.yml
@@ -1,16 +0,0 @@
1
- name-template: 'v$NEXT_PATCH_VERSION'
2
- tag-template: 'v$NEXT_PATCH_VERSION'
3
- categories:
4
- - title: '🚀 New Features'
5
- label: 'feature'
6
- - title: '🐛 Bug Fixes'
7
- label: 'bug'
8
- - title: '🧰 Maintenance'
9
- label: 'maintenance'
10
- change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
11
- template: |
12
- ## What's Changed
13
-
14
- $CHANGES
15
-
16
- **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$NEW_TAG
@@ -1,7 +0,0 @@
1
- from .cheap_utils import are_strings_similar, is_valid_string, separate_artists
2
-
3
- __all__ = [
4
- "are_strings_similar",
5
- "is_valid_string",
6
- "separate_artists",
7
- ]
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