soulsync/core/downloads
Broque Thomas daaed373e7 fix(provenance): label torrent/usenet/staging downloads correctly in history
The download history modal was tagging every torrent / usenet
album-bundle download as 'Soulseek FLAC 24bit' because:

- core/imports/side_effects.py's source_service dict didn't have
  entries for 'staging', 'torrent', or 'usenet' usernames. The
  staging matcher in core/downloads/staging.py sets
  download_tasks[task_id]['username'] = 'staging', which fell
  through to the dict's default and got recorded as 'soulseek'
  in the track download provenance row. Same fate for any
  amazon or other source that wasn't whitelisted.

- The album-bundle flow specifically wants to be labeled as
  'torrent' or 'usenet' (where the bytes actually came from),
  not 'staging' (the intermediate). The plugin already stashes
  the source on the batch state as ``album_bundle_source`` for
  the Downloads-page status card; provenance recording can
  read the same field.

Fixes:
- core/downloads/staging.py: when marking a task post_processing
  after a staging match, check the batch's album_bundle_source
  override and use that for username instead of 'staging' when
  set. Falls back to 'staging' when no override exists
  (manual file-drop case).
- core/imports/side_effects.py: source_service map gets entries
  for 'staging', 'torrent', 'usenet', and the previously-missing
  'amazon' (which was also falling through to 'soulseek').
- webui/static/library.js: the redownload modal's serviceLabels
  / serviceIcons dicts extended to cover lidarr, amazon,
  soundcloud, auto_import, staging, torrent, usenet so badges
  render the correct name instead of either the raw source_service
  string or no badge at all.
- webui/static/wishlist-tools.js: history-source-chip color
  palette extended for the new source labels (Torrent sky-blue,
  Usenet violet, Staging / Auto-Import neutral grey).

Note: existing tracks in the DB still carry the wrong 'soulseek'
label — only NEW downloads after this fix get the right label.
A future migration could rewrite historical rows but it's
cosmetic and the underlying audio + metadata are correct.
2026-05-20 19:31:47 -07:00
..
__init__.py PR4a: lift sync history recording to core/downloads/history.py 2026-04-27 20:37:16 -07:00
cancel.py diag: log every cancel_download caller with a trigger label 2026-05-19 22:31:29 -07:00
candidates.py diag: log every cancel_download caller with a trigger label 2026-05-19 22:31:29 -07:00
cleanup.py PR4c: lift _automatic_wishlist_cleanup_after_db_update to core/downloads/cleanup.py 2026-04-27 22:23:41 -07:00
history.py PR4a: lift sync history recording to core/downloads/history.py 2026-04-27 20:37:16 -07:00
lifecycle.py fix(downloads): wait for post-processing result 2026-05-20 09:39:56 -07:00
master.py feat(downloads): album-bundle flow for torrent/usenet single-source mode 2026-05-20 18:48:48 -07:00
monitor.py fix(downloads): wait for post-processing result 2026-05-20 09:39:56 -07:00
post_processing.py Cin-6: Rename soulseek_client global → download_orchestrator 2026-05-04 23:23:32 -07:00
staging.py fix(provenance): label torrent/usenet/staging downloads correctly in history 2026-05-20 19:31:47 -07:00
status.py Harden quarantine approval flows 2026-05-18 08:37:11 -07:00
task_worker.py fix(amazon): wire amazon into all streaming-source guards 2026-05-16 10:24:13 -07:00
validation.py fix(downloads): route torrent/usenet through streaming-result validation path 2026-05-20 18:27:14 -07:00
wishlist_failed.py Surface silent exceptions across remaining modules — ~70 sites 2026-05-07 10:28:58 -07:00