Shazam API wrapper
Project description
shazam.py
Python library for the Shazam API. This library is based off of ShazamAPI and SongRec but some added features.
NOTE: that this is still in its design and development phase. It works and *could* be used in production but beware of possible breaking changes.
Install
pip3 install shazam.py
If you're on linux, you'll also have to install pkg-config
and libasound2-dev
with your preferred package manager.
Usage
Synchronous Shazam:
from shazam import Shazam
mp3_file = open('a.mp3', 'rb').read()
with Shazam(mp3_file) as shazam:
print(shazam.result) # data received from the shazam api
A partially-asynchronous method is also provided: (partially because only requests are done asynchronously and not the signature generation. See #1)
from shazam import AsyncShazam
mp3_file = open('a.mp3', 'rb').read()
async with AsyncShazam(mp3_file) as shazam:
print(shazam.result)
There is also support for using your own session objects and using Shazam
and AsyncShazam
outside of
a context manager using the execute function.
Notes on the Shazam API
Shazam's api takes a "signature" of a song to search in their database before returning a result.
If you want to know more about the specifics of the algorithm, you can read the paper written by a co-founder of Shazam.
The implementation of the algorithm was written by @marin-m in their project. It was adapted to work with python through pyo3 here.
Why is this better than all other libraries ever?
Because rust
Credits to:
https://github.com/marin-m/SongRec https://github.com/Numenorean/ShazamAPI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for shazam.py-1.0.0-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b33a4c2672d5f6910aec3a2cffb63397f0a1db15aeb57f27acf9a340b0bbf7d9 |
|
MD5 | 375f79ac41adfb2f25aeeea45b8321a8 |
|
BLAKE2b-256 | 2d714f2ca282850735f8bfe22de4c2537ba26391e1503afa1753cca3641aaaf1 |
Hashes for shazam.py-1.0.0-1-cp310-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ed2f8ca97548c608f9a841076d47769ced330075e9589d58ebf3b3fdbae2f30 |
|
MD5 | 28cdaafc0318021974b832df6eee22ce |
|
BLAKE2b-256 | 0a7f431586233632973965f207e888bc6833f5150ff9976e30cfb02010f64bb7 |