Open SimonIT opened 3 years ago
Can you provide the code used to generate this error.
my_ses = requests.Session()
my_ses.proxies.update(Config.PROXY)
engine = ComboLyricsProvider(session=my_ses)
search = SearchRequest(song.artist, song.name)
result = engine.search(search)
What is Config.PROXY
's value
It's an empty dictionary
Ok, and finally what is the song you are using? I need this because I suspect the engine is having trouble with that specific song or case.
https://www.syair.info/lyrics/modjo/lady/Ykx5VQ https://www.megalobiz.com/lrc/maker/Beyonc%C3%A9+-+Single+Ladies+%28Put+a+Ring+on+It%29.54733707 These are the lyrics where the exceptions happen
I see.
https://www.syair.info/lyrics/modjo/lady/Ykx5VQ does not have valid LRC text.
See the LRC regex we match against:
line_regex = re.compile(r'\[(?:(\d+):)?(\d+)(?:\.(\d+))?\]([^\[]+)')
Normally we get matches like this:
And what the lady
modjo
file looks like:
What do you think the library should do when it sees a Lyrics File like this and cannot parse it?
I think I could change the return cases of the providers from:
return Lyrics(full_text)
to
try:
return Lyrics(full_text)
except InvalidLyricsException:
return None
I will be able to implement that later this week.
I think that's valid. I had this already multiple times.
I handle this in https://github.com/doakey3/pylrc correct If you look here https://de.wikipedia.org/wiki/LRC_(Dateiformat)#Aufbau, it's also an example how to shorten lyrics with duplicate lines
Ok I can change the parsing later this week. Basically the tag processing and text processing will be split up then we have to sort the lyrics based on the time.
I no longer have time to fix this issue, but open to PRs! :)