Add support for lyrics markup and annotations#161
Open
berniyh wants to merge 16 commits into
Open
Conversation
added 16 commits
July 26, 2026 09:25
This allows to fetch from providers like genius that spread lyrics across multiple containers.
This was likely done to remove trailing whitespace, but in some cases it will actually drop the last character of the actual lyrics. The code runs trimmed(), which will remove trailing whitespace, so it shouldn't be required anyways.
This is done by saving metadata to a json file in cache. If this file exists, we check if it was created at the same time as the lyrics file, i.e. the simplest way to check if it is stale. If the file exists and is valid, attempt to load the provider and url from it and show that in the lyrics page.
Gated by a markup option, since I can't test every provider, so this seemed to be the safe route.
Guided by an option, this allows to indicate and show available annotations for the loaded lyrics.
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.
Note that this is built on top of #160. Just can't compare against that branch while submitting the PR to your repository. So only the last 5 commits 53712e7..012a3cd are relevant here.
I put these 5 commits into a new PR, because they are a bit more invasive than the previous commits. That's mainly, because to handle the metadata, we create a new lyrics metadata json file that sits in cache. This can contain links, markups, annotation references and possibly more. Without the json, a lyrics file loaded from disk would have no source. On the other hand, we don't want to save to the lyrics file to avoid breaking other programs.
Here are the added features in detail:
I already attempted an implementation of the annotations feature last year, but back then I did it by rendering it in an actual webpage, which created a bit of a mess, so I decided to drop it. The new approach is less invasive, cleaner and it properly works (at least with all the things that I tested so far). I still think that having proper html5 capability could be beneficial. e.g. could highlight using color marks like Genius itself does it or to show the voting on annotations. If you think so, too, that could be part of future work.
Note that again, I implemented this using Claude Opus 5. I tried to review the code to the best of my abilities.