feat(common): improve Release Type detection algorithm - #953
Conversation
|
Looks good to me. But AI points out a possible bug
The 2-track fallback bugTake a look at the sequential logic in the } else {
// no duration, try to guess by the number of tracks only.
if (perhaps_EP) return "EP";
if (perhaps_single) return "single";
if (perhaps_album) return "album";
}Because In practice, a 2-track release—usually an A-side/B-side pair, an instrumental, or a remix bundle—is almost always a Single. Checking the EP threshold first causes immediate misclassifications here. The fix: Reorder the sequence so the logic catches 1- or 2-track releases as a single before checking the EP threshold. A different way to handle thisFor some context on how to make this even more reliable, look at how Instead of looking at duration, it strips common technical terms from the track titles (things like Remix, Instrumental, Edit, Live, or Version) and compares what is left. If a multi-track release deduplicates down to a single unique title, the script overrides the status to a Single because it knows the release just contains alternate versions of the same song. Relying strictly on track numbers and durations is always going to hit edge cases—especially with modern streaming singles that often bundle 3 or 4 tracks. Implementing a title-deduplication check like that would be a great way to make this guesser bulletproof. |
This is often the case for Vinyl records, but not always true, especially for a bunch of electronic genres. It we reorder the sequence, then EP branch will never trigger for releases without duration, since Single branch with 1..6 tracks will include the 2..6-track branch for EP. Additionally the set EP vs. Single sets intersection for releases with a present duration will change in ways that I cannot really see clearly.
I suppose this is a great idea. I will try to add it in the next iteration. But I don't think it should completely replace the type-guesser based on the track numbers/durations, because then we will be left with quite a large number of releases which could be easily classified based on those parameters. Instead, I think we should first try to normalise song names and deduce if it's a Single, and if it yields no results then fall back on the current algo. Let me know your thoughts. |
I'm aware of that. I added quite a lot of techno stuff where EPs are common for 2-track releases. Regarding the Harmony Enhancements script, Harmony doesn't do much release type guessing instead relying on the providers, which also classify based on track count and duration.
Agree, such singles are easy to detect and rarely not a single per artist/label. If the release title contains EP it should still take precedence. |
|
BTW some unit tests could probably be added for verifying the expected behavior :) |
Uh oh!
There was an error while loading. Please reload this page.