Add 'prioritize' parameter to prefer synced or plain lyrics to /get and /search routes - #46
Open
sel10ut wants to merge 1 commit into
Open
Add 'prioritize' parameter to prefer synced or plain lyrics to /get and /search routes#46sel10ut wants to merge 1 commit into
sel10ut wants to merge 1 commit into
Conversation
* Adds 'prioritize' parameter to '/get' and '/search' routes. It adds the ability to elevate synced or plain lyrics in results. This is useful, for example, for ordering tracks with synced lyrics first.
|
Very much required. I am oftentimes getting plain lyrics when I can go on lrclib.net and see that synced lyrics exist!! |
|
When using the /api/get call you will get both plainLyrics and syncedLyrics, either of which can be empty/null. If the synced lyrics exist then you'll write them to a .lrc file to be loaded by your music app, otherwise you can embed the plainLyrics directly into the mp3 file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
There are situations when there are multiple best matches, but the first one only has plain lyrics, while others include synced, but are also exactly or closely matched. It appears to be that the results are sorted by
idor date added.This PR adds an optional parameter that enables soft prioritization logic, the ability to order lyrics by using a trivial
ORDER BYclause and existing DB columnshas_synced_lyricsandhas_plain_lyrics. It simply elevates the chosen kind to the top while keeping the match ranking and initial sort. If tracks with the chosen kind don't exist, the other kinds will be the top result as is.This logic could also be implemented without the parameter and enabled by default to prioritize synced lyrics. However, there are possibilities where it could mess up the search result if the user's query is not specific and relevant enough. It may give unrelated tracks that have synced lyrics.
Closes #28 #10