-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from shazamio/dev2.0
Dev2.0
- Loading branch information
Showing
36 changed files
with
668 additions
and
369 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/python | ||
{ | ||
"name": "Python 3", | ||
"image": "mcr.microsoft.com/devcontainers/python:3.8", | ||
"features": { | ||
"ghcr.io/devcontainers-contrib/features/poetry:2": {}, | ||
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { | ||
"packages": "ffmpeg" | ||
} | ||
} | ||
} |
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,12 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for more information: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
# https://containers.dev/guide/dependabot | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "devcontainers" | ||
directory: "/" | ||
schedule: | ||
interval: weekly |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import asyncio | ||
from shazamio import Shazam, Serialize | ||
|
||
|
||
async def main(): | ||
shazam = Shazam() | ||
albums = await shazam.search_album(album_id=1544741796) | ||
serialized = Serialize.album_info(data=albums) | ||
|
||
for i in 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
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.