Repository navigation
Conversation
When Spotify only has line timings, the word timings from NetEase or Musixmatch replace them as they are. Those sources often timed another cut of the recording, so the whole text runs early or late by a fixed amount (NetEase YRC for "Lose Yourself" is 1.2 s ahead). Shift the word timings by the median offset between matching lines. When the offset varies by more than a second across the song, it is a different version, so the Spotify lines stay. Bump the cache to 10 so the old unaligned upgrades are fetched again.
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.
When Spotify only has line timings,
fetch_cachedswaps them for the word timings from NetEase or Musixmatch as they come. Those sources often timed another cut of the recording (a different intro, a remaster), so the whole text runs early or late by a fixed amount. NetEase YRC for "Lose Yourself" is 1.2 s ahead of the LRCLIB lines, and its duration is 4 s shorter than the Spotify one.Now the word timings are shifted by the median offset between lines with the same text. If the offset spreads by more than a second across the song, the source fits another version, so the Spotify lines stay. Under 3 matching lines nothing changes. The lyrics cache goes to version 10 so the old upgrades are fetched again.
Checked with the app on a real account:
Tests:
cargo test -p mf-lyrics(3 new: shift, other cut rejected, unmatched left alone).How to test: play a track whose Spotify lyrics are line by line and that NetEase has word lyrics for (Blinding Lights works), skip away and back once the upgrade is cached, and run with
RUST_LOG=mf_lyrics=debugto see the applied shift.