fix(eternal-jukebox): fall back to equivalent track analysis#94
Open
urroxyz wants to merge 1 commit into
Open
Conversation
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.
I was looping my favorite song with Eternal Jukebox and enjoying it. But later, when trying the same track, Eternal Jukebox just hung indefinitely.
Turns out that Spotify was returning a 404 in the background and the app didn't know how to handle it. The former is simply because Spotify has multiple IDs for a track since some tracks are released/distributed multiple times. This is a fix for the latter.
Summary
Spicetify.getAudioDatabefore using it.Problem
Spicetify.getAudioDatacan resolve to an HTTP error object such as:Because that object is truthy, Eternal Jukebox treated it as valid analysis and then crashed while reading
analysis.beats.length. Spotify can also assign a new catalog ID to an existing recording without copying its audio analysis, even when another release of the same recording still has valid beat and segment data.Solution
The Jukebox now validates all arrays required by the remixer. If the current ID has no usable analysis, it searches Spotify for exact title/artist matches, ranks candidates by duration difference, and accepts only tightly duration-matched analysis.
Testing
tsc --noEmitspicetify-creator --out=dist --minifyspotify:track:6st8aj6PmtqGctnLAat95M(Life Goes Onby The Sundays), whose direct analysis request returns404