soulsync/core/wishlist
BoulderBadgeDad d15b3a185d Track "01" bug: recover real track position instead of fabricating 1
Single tracks (esp. Deezer-sourced) imported as "01 - Title" regardless
of their real album position — e.g. Fly Away (track 2 of Greatest Hits)
landed as 01, littering album folders with duplicate "01" files.

Root cause: a Deezer single track is matched via /search/track, which
omits track_position, so the context never carried the real number; then
service.py + context.py fabricated a confident track_number=1 from that
gap. Because the resolver puts that first, the fake 1 beat the source.
It is source-agnostic (slskd-with-Deezer-metadata hits it too) — albums
work because /album/<id>/tracks DOES include positions.

Fix (at the shared import funnel, strictly additive):
- track_number.py: new read_embedded_track_number() (mutagen, local, no
  network) + an optional embedded_track_number arg on resolve_track_number.
  The downloaded file already carries the source-written position (deemix
  wrote it); consult it LAST — only when metadata AND the "NN - Title"
  filename both come up empty — so it can only fill the gap that would
  otherwise hit the default-1 floor. Never overrides a value the pre-fix
  resolver produced (no regression for correctly-named/mistagged files).
- pipeline.py: read the file tag at the resolve step and pass it in.
- De-poison: service.py:217 + context.py default to 0 (the existing
  "unknown" sentinel, like total_tracks), NOT 1 — so the fake 1 no longer
  blocks recovery. Frontend already treats falsy track_number as unknown
  (omits it), so this also drops the bogus "1." in the UI.

13 new resolver tests incl. the no-regression precedence guards; full
imports + wishlist suites green (583), no behavior change for albums.
2026-06-15 23:35:48 -07:00
..
__init__.py Extract wishlist logic into dedicated package 2026-04-28 21:17:24 +03:00
album_grouping.py Wishlist: only engage album-bundle when multiple tracks from same album (PR 1/4) 2026-05-27 13:42:04 -07:00
classification.py Coerce wishlist track counts before category checks 2026-04-30 21:42:43 +03:00
ignore.py #874: wishlist ignore-list — stop auto-retrying removed/cancelled tracks 2026-06-15 22:50:39 -07:00
payloads.py Wishlist: fix three regressions causing all imports to land as track 01 with no year 2026-05-27 15:39:22 -07:00
presence.py Add module logger + surface silent exceptions in 7 logger-less files — 12 sites 2026-05-07 10:27:04 -07:00
processing.py Wishlist: serialize album-bundle downloads so they stop flooding the search pool (Sokhi #740) 2026-06-09 10:06:53 -07:00
reporting.py Extract wishlist logic into dedicated package 2026-04-28 21:17:24 +03:00
resolution.py Make wishlist respect configured providers 2026-04-30 07:41:22 +03:00
routes.py #874: wishlist ignore-list — stop auto-retrying removed/cancelled tracks 2026-06-15 22:50:39 -07:00
selection.py Make wishlist respect configured providers 2026-04-30 07:41:22 +03:00
service.py Track "01" bug: recover real track position instead of fabricating 1 2026-06-15 23:35:48 -07:00
state.py Extract wishlist logic into dedicated package 2026-04-28 21:17:24 +03:00