-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shazam has changed the contract for obtaining top songs: - Top tracks in country by genre - Top tracks in country - Top tracks in city - Top tracks in world by genre - Top tracks in world We managed to maintain this functionality, but the format of the responses has changed, as have the response models! Please make corrections, the data has changed significantly!!! Added `playlist` and `playlists` methods for Serialize.
- Loading branch information
Showing
29 changed files
with
496 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import asyncio | ||
import logging | ||
|
||
from aiohttp_retry import ExponentialRetry | ||
|
||
from shazamio import Shazam, Serialize, HTTPClient | ||
|
||
logger = logging.getLogger(__name__) | ||
logging.basicConfig( | ||
level=logging.DEBUG, | ||
format="%(asctime)s - %(name)s - [%(filename)s:%(lineno)d - %(funcName)s()] - %(levelname)s - %(message)s", | ||
datefmt="%Y-%m-%d %H:%M:%S", | ||
) | ||
|
||
|
||
async def main(): | ||
shazam = Shazam( | ||
http_client=HTTPClient( | ||
retry_options=ExponentialRetry( | ||
attempts=12, max_timeout=204.8, statuses={500, 502, 503, 504, 429} | ||
), | ||
), | ||
) | ||
|
||
new_version_path = await shazam.recognize("data/Gloria.ogg") | ||
|
||
album_info = await shazam.search_album(album_id=new_version_path["track"]["albumadamid"]) | ||
album_serialized = Serialize.album_info(data=album_info) | ||
# Get album name | ||
print(album_serialized.data[0].attributes.name) | ||
|
||
# And get all tracks in album | ||
for i in album_serialized.data[0].relationships.tracks.data: | ||
msg = ( | ||
f"{i.id} | {i.attributes.album_name} | {i.attributes.artist_name} [{i.attributes.name}]" | ||
) | ||
print(msg) | ||
|
||
|
||
loop = asyncio.get_event_loop_policy().get_event_loop() | ||
loop.run_until_complete(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.