quintodrome/core/external
Deluan Quintão 5db585e1b1
refactor: use duration as a soft ranking signal instead of hard cutoff in track matching (#4944)
* refactor: integrate duration into matchScore instead of using pre-filter

Duration matching was handled as a binary pre-filter with fallback,
inconsistent with how title, specificity, and album are scored via the
matchScore system. Move duration into matchScore as a boolean field
ranked between title similarity and specificity level, making all
match criteria use the same hierarchical comparison.

https://claude.ai/code/session_01BWJ5aAzbQRvwjB7PvUcNYs

* refactor: remove findBestMatchInTracks function and integrate its logic into findBestMatch

Signed-off-by: Deluan <deluan@navidrome.org>

* refactor: use duration proximity score instead of boolean match

Replace the binary durationMatch bool with a continuous durationProximity
float64 (0.0-1.0) using 1/(1+diff). This removes the hard 3-second
tolerance cutoff, so closer durations are always preferred over farther
ones without an arbitrary cliff edge.

https://claude.ai/code/session_01BWJ5aAzbQRvwjB7PvUcNYs

* style: fix gofmt alignment in matchScore struct

https://claude.ai/code/session_01BWJ5aAzbQRvwjB7PvUcNYs

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Claude <noreply@anthropic.com>
2026-01-27 11:12:18 -05:00
..
extdata_helper_test.go feat: add similar songs functionality in agents, and Instant Mix (song-based) to UI (#4919) 2026-01-25 16:16:43 -05:00
extdata_suite_test.go refactor: external_metadata -> external.Provider (#3903) 2025-04-08 21:11:09 -04:00
provider.go feat: add similar songs functionality in agents, and Instant Mix (song-based) to UI (#4919) 2026-01-25 16:16:43 -05:00
provider_albumimage_test.go feat: make Unicode handling in external API calls configurable (#4277) 2025-12-02 13:08:30 -05:00
provider_artistimage_test.go feat: make Unicode handling in external API calls configurable (#4277) 2025-12-02 13:08:30 -05:00
provider_matching.go refactor: use duration as a soft ranking signal instead of hard cutoff in track matching (#4944) 2026-01-27 11:12:18 -05:00
provider_matching_internal_test.go feat: add similar songs functionality in agents, and Instant Mix (song-based) to UI (#4919) 2026-01-25 16:16:43 -05:00
provider_matching_test.go refactor: use duration as a soft ranking signal instead of hard cutoff in track matching (#4944) 2026-01-27 11:12:18 -05:00
provider_similarsongs_test.go feat: add similar songs functionality in agents, and Instant Mix (song-based) to UI (#4919) 2026-01-25 16:16:43 -05:00
provider_topsongs_test.go feat: add similar songs functionality in agents, and Instant Mix (song-based) to UI (#4919) 2026-01-25 16:16:43 -05:00
provider_updatealbuminfo_test.go feat(plugins): experimental support for plugins (#3998) 2025-06-22 20:45:38 -04:00
provider_updateartistinfo_test.go feat(agents): add ID field to Artist and Song structs with direct matching 2026-01-11 17:06:25 -05:00