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 taipan-di
Poetry
Poetry is a Python dependency management and packaging tool. I actually use it for this project.
poetry add taipan-di
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
File details
Details for the file lyrics_client-0.0.1.tar.gz
.
File metadata
- Download URL: lyrics_client-0.0.1.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.16 Linux/5.15.0-1038-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58cc573ac64fd6774b26ae4b9ad532f195e716aa36527f8c38bd9b31b184fada |
|
MD5 | bc9a2928634252f1b5def48ddb2bea3b |
|
BLAKE2b-256 | 6c6fe69381480a8a0793dd4b0ece7195fd44b10f90163cee7c0e9948a4185e4e |
File details
Details for the file lyrics_client-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: lyrics_client-0.0.1-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.16 Linux/5.15.0-1038-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a34c0f8b6628acf6331b08466e2097c20058aa2951a881923ef9c5582a228ff |
|
MD5 | c6408796c8caf857538fe6e0fed52fc3 |
|
BLAKE2b-256 | 88f831d6f06a6259aaba62c2e5b2aa916f050b4163d352b593b02a0751711db1 |