Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local lyrics source #29

Closed
emiham opened this issue Oct 18, 2023 · 4 comments · Fixed by #35
Closed

Local lyrics source #29

emiham opened this issue Oct 18, 2023 · 4 comments · Fixed by #35

Comments

@emiham
Copy link

emiham commented Oct 18, 2023

As mentioned in #22 (comment), downloading lyrics is a bit out of scope for this application, but since it was mentioned there are other ways to do this, would it be reasonable to allow for this application to show downloaded lyrics, forgoing an API? I think it would provide a lot of peace of mind knowing that the lyrics will always be there for you. From the name I'm guessing this project started out only for Spotify, but for people who use MPD or other local players I think this is a not too uncommon concern.

@raitonoberu
Copy link
Owner

This can certainly be implemented by applying some kind of fuzzy search in a directory with .lrc files. I'll take a closer look at this and will most likely add it in the next update.

@emiham
Copy link
Author

emiham commented Oct 30, 2023

After looking a bit more into this myself:
Generally .lrc files seem to be directly coupled with audio files, either embedded in a tag or in the same folder with identical filenames (apart from the extension), or possibly in a separate lyrics folder with the same filenames. Not sure how you feel about reading from tags, but the other two at least probably make sense for this project. Personally I like tags the best, but it seems the most far off from the Spotify use case.

@raitonoberu
Copy link
Owner

Well, I implemented it... kind of. You can check the local branch.

The current implementation goes through the specified folder, finds the .lrc files and creates an index of these files. Each file is presented as a list of words in its name. Then, for each query, for each file in the index, it calculates a "score" - how many words in the query are equal to the words in the file name. The file with the maximum score is used.

The complexity is O(N*n*m), where N - number of indexed files, n - length of indexed names (average), m - length of the query. However, this is fast enough: indexing of 1000 files takes ~2ms and querying takes ~200µs.

It works fine on all the tracks I've tested it on. But testing is required to find all the edge cases. And it would be great to find a more effective algorithm.

@fxzzi
Copy link

fxzzi commented Jun 6, 2024

Liking the .lrc support, however why not just parse from the lyrics tag in the file? Can use a script like https://github.com/TheRedSpy15/lrcput to embed all your .lrc files, and then there's no guessing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants