-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Add Lyrics API Endpoint #8381
Add Lyrics API Endpoint #8381
Conversation
Changes in OpenAPI specification found. Expand to see details.What's New
|
Co-authored-by: Cody Robibero <cody@robibe.ro>
Co-authored-by: Cody Robibero <cody@robibe.ro>
Co-authored-by: Cody Robibero <cody@robibe.ro>
|
I've looked at the API part only thinking how I would implement a lyrics feature in our Android apps. These are my findings:
I think an API response might end up looking somewhat like this: {
"metadata": {
"//": "Either a Dictionary<string,string> or a proper object with \"known\" id3 tags like Artist/Album etc",
"artist": "Artist name",
"title": "Track name",
},
"lines": [
{ "start": 0, "text": "Line 1" },
{ "start": 100, "text": "Line 2" },
{ "start": 300, "text": "Line 2" },
]
}Some of the above mentioned stuff might be out of scope for this PR but these are my thoughts for now. |
|
Thanks for all the helpful comments y'all! I'll start working through these. |
Co-authored-by: Neil Burrows <neil@pawprint.co.uk>
Would this be satisfied by adding a HEAD endpoint that indicates whether or not lyrics are found?
It'll be all or nothing. Either you get something back, or you get a 404 response.
Yes, they will be ordered in ascending order.
They will be ticks
Yes across the board, but it will be encoded. Perhaps we could have an optional strip parameter to remove unwanted values (eg, strip HTML, string line breaks, etc.) Example:
I'll look into what it'll take to add ID data to the response.
What file format are they? Are the TXT or are they still LRC files?
The line level timestamp will be used as the Start value in the JSON, and the word times will be passed as part of the Text value. This way clients are free to do with them as they please (use them, ignore them, etc.). Example: |
I was thinking adding it to the BaseItemDto in some way, there is a mediasources property where each source has mediastreams. lyrics could maybe be one of them, idk.
So why is there an error property in the responses then?
lrc files but without timestamps at the start of each line. The Foobar2000 plugin UI slowly scrolls those lyrics. |
I'll take a look and see what I can come up with.
Originally I was returning an error description along with the NotFound(), but after code suggestions from Cody, it's no longer doing that. I'm updating the responses now and the error property will be removed.
Interesting. So essentially a TXT file in an LRC container. I'll take a look at it. |
|
Thank you very much for this PR, been wanting to implement proper lyric support in Vue! Two points though:
|
I'd like to keep the scope of this PR focused on local file support, but that sounds like a wonderful followup PR.
I agree, so that's what I'm basing it on in the updated code. The server makes no assumptions about the data other than parsing meta and timestamps if present. Anything else in the text will get returned and clients can do what they want with it. |
|
I think I covered everything mentioned above. Below is some sample output. LRC File with MetaData LRC File without Metadata or TimeStamps TXT File |
|
Additionally, I added the field HasLocalLyricsFile the get item API call. If a local lyric file is found and has a corresponding provider, this value will be true. |
This is adding those lyric providers to the DI pipeline along with a super simple implementation of how to use them in the controller method. Probably should be refactored into a lyric service of some sort that would have the providers injected into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API part looks good to me 👍
Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After these cosmetic changes it should be fine
Co-authored-by: Bond-009 <bond.009@outlook.com>
|
Hi, I'm trying to start implementing client support for the new lyrics endpoints, but the endpoints don't seems to be in the |
|
I found the problem. |

Changes
Adds an API endpoint to get lyrics for a requested item. The lyrics are sourced from local .LRC or .TXT files and returned as JSON for client consumption.
Lyric files must match the filenames for their corresponding item.
For example: The lyric file for
01 Death Eternal.mp3must be01 Death Eternal.lrcor01 Death Eternal.txtSample Response
Notes
This change uses a compiled version the NuGet package LrcParser.