moehmeni / syncedlyrics

Get an LRC format (synchronized) lyrics for your music
MIT License
239 stars 23 forks source link

Searching by metadata #12

Open Vuizur opened 1 year ago

Vuizur commented 1 year ago

I think it would be great to have the option to search by metadata, so something like artist, title, album and duration. Both MusixMatch and LRClib seem to support it. It has been implemented in https://github.com/fashni/MxLRC, so one could copy some code. In my testing I got better results when using this metadata, because pure search sometimes gives false lyrics back/finds the wrong song.

I could also try to do a PR if you want 👍.

moehmeni commented 1 year ago

Can you please give an example? Maybe we could use text similarity libs like rapidfuzz if the true match is among the search API results but not the first song.

Vuizur commented 1 year ago

One example is Rome - To Die Amongs Strangers. Mxlrc gives me the correct lyrics with python .\mxlrc.py -s Rome,"To Die Amongst Strangers.

from syncedlyrics import search

lrc = search("Rome To Die Amongst Strangers", providers=["Musixmatch"])
print(lrc)

fails with

Traceback (most recent call last):
  File "c:\Users\hanne\Documents\Programme\syncedlyrics\mytest.py", line 3, in <module>
    lrc = search("Rome To Die Amongst Strangers", providers=["Musixmatch"])
  File "c:\Users\hanne\Documents\Programme\syncedlyrics\syncedlyrics\__init__.py", line 39, in search
    lrc = provider.get_lrc(search_term)
  File "c:\Users\hanne\Documents\Programme\syncedlyrics\syncedlyrics\providers\musixmatch.py", line 90, in get_lrc
    return self.get_lrc_by_id(tracks[0]["track"]["track_id"])
IndexError: list index out of range

(But this crash might be different problem.)

Another example where simply the wrong lyrics are fetched (but mxlrc fetches the correct ones) is Best Coast - Wasted Time.

I think the easiest way to get it to work would be copying this: https://github.com/fashni/MxLRC/blob/main/mxlrc.py#L26 . (Maybe in a new function to not break the old API)

calm3285 commented 9 months ago

i been using this script for downloading lyrics https://github.com/whatihavedone/lrc_fetcher/blob/main/lyrics_fetcher.py

Skidudeaa commented 8 months ago

i been using this script for downloading lyrics https://github.com/whatihavedone/lrc_fetcher/blob/main/lyrics_fetcher.py

am I reading this correctly that it spreads the lyrics out equally throughout the duration of the song? If so that would be kind of useless, the wrong timestamps more or less for the whole song?

calm3285 commented 8 months ago

i been using this script for downloading lyrics https://github.com/whatihavedone/lrc_fetcher/blob/main/lyrics_fetcher.py

am I reading this correctly that it spreads the lyrics out equally throughout the duration of the song? If so that would be kind of useless, the wrong timestamps more or less for the whole song?

i just use it to grab nonsync lyrics

WorldOfDex commented 3 months ago

I Already builded this so wait for somedays , i have to reverify it and i will upload in my repo