A generic client to fetch lyrics from a song's data
Project description
Lyrics-Client
Get the lyrics of your favorite musics !
Features
- Automatic lyrics fetching from different services
- Currently supported : Genius, Musixmatch, AZLyrics
- Title and artist verification to find the best match
- Easy to use, straightforward interface
- Extensive results information
- Possible to use via DI integration
Installation
Pip
pip install lyrics-client
Poetry
Poetry is a Python dependency management and packaging tool. I actually use it for this project.
poetry add lyrics-client
Usage
There are 2 ways to use this library : using the LyricsClient object or via the DI.
Using LyricsClient
The library exposes the LyricsClient class. This class has 2 methods : get_lyrics
and get_from_song
.
Both methods do the same thing : fetching lyrics and returns the results in a list of FetchLyricsResult
.
However, get_lyrics
accept a FetchLyricsCommand
object as parameter, while get_from_song
accept a song title, the song artists and optionally the clients to use.
Example :
from lyrics_client import LyricsClient
client = LyricsClient()
results = client.get_from_song("in the end", "linkin park")
lyrics = results[0].lyrics
Using DI
The library also exposes a BaseLyricsClient
interface and a add_lyrics_client
function for Taipan-DI.
In this method, the clients are registered as a Pipeline. All you need to do is to resolve the pipeline and execute it.
Example :
from lyrics_client import BaseLyricsClient, add_lyrics_client, FetchLyricsCommand
from taipan_di import DependencyCollection
services = DependencyCollection()
add_lyrics_client(services)
provider = services.build()
client = provider.resolve(BaseLyricsClient)
request = FetchLyricsCommand("in the end", "linkin park")
results = client.exec(request)
lyrics = results[0].lyrics
Inspirations
This library is partially based on spotDL's spotify-downloader.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for lyrics_client-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f30b77e230d046dad4cc02ab3fedb09d0dc5cf1681da2d08e4e1cbc61eaa375a |
|
MD5 | 1a56ed0a67f2fb8982d20cf1dbd3c276 |
|
BLAKE2b-256 | b42fc885667ed92ed785d48ab6ac97c79c947cad3c5ec04c6fe3e5f51b381454 |