Skip to content

[torrent] match RuTracker album bundle files - #969

Draft
ramonskie wants to merge 2 commits into
Nezreka:devfrom
ramonskie:fix/rutracker-album-bundle-matching
Draft

[torrent] match RuTracker album bundle files#969
ramonskie wants to merge 2 commits into
Nezreka:devfrom
ramonskie:fix/rutracker-album-bundle-matching

Conversation

@ramonskie

@ramonskie ramonskie commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

DRAFT:
this is a draft. as i did not test the whole worflow.
i just want to start a discussion. as rutracker is not working with lidarr either.
and i want to know if this is the right approach.

Summary

Fix torrent/usenet album-bundle staging for RuTracker-style releases.

RuTracker music torrents often download files with release-style names instead of clean tags, e.g.:

  • Nosferatu_-_Beaver_Cleaver.flac
  • 01 - 4 Tune Fairytales - Take Me 2 Wonderland (Extended Mix).flac

The album-bundle flow already downloads and stages these files correctly, but try_staging_match() compared raw filename stems against clean Spotify track titles. That caused staged album files to be missed, especially for compilations and artist-prefixed filenames.

Changes

  • Parse common release filename shapes during private album-bundle staging:
    • Artist_-_Title
    • Artist - Title
    • NN - Artist - Title
    • NN - Title
  • Use parsed filename title/artist as additional match candidates.
  • Use explicit track numbers as a guard/boost for private album-bundle matches.
  • Skip stale staged-file cache entries when the file was already claimed and removed.
  • Add integration coverage using real TorrentDownloadPlugin.download_album_to_staging() with mocked Prowlarr/torrent-client boundaries.
  • Add RuTracker source examples as regression fixtures:

Why

This fixes album downloads where the torrent completes successfully but tracks are not claimed from private staging due to filename/tag mismatch.

Tests

  • python -m pytest tests/downloads/test_album_bundle_rutracker_integration.py tests/downloads/test_downloads_staging.py -q
  • python -m ruff check core/downloads/staging.py tests/downloads/test_album_bundle_rutracker_integration.py tests/downloads/test_downloads_staging.py
  • python -m pytest

@ramonskie ramonskie changed the title fix: match RuTracker album bundle files [torrent] match RuTracker album bundle files Jul 2, 2026
@ramonskie

Copy link
Copy Markdown
Contributor Author

Torrent/usenet album-bundle downloads are already release-level: the selected torrent/NZB downloads the whole album/release. The per-track part happens only after download, during SoulSync’s existing import/post-processing handoff.

Current flow:

  1. Pick one torrent/usenet release for the album.
  2. Downloader fetches the whole release.
  3. SoulSync copies all audio files into private album-bundle staging.
  4. Existing per-track workers run for each expected album track.
  5. Each worker calls try_staging_match() to claim the staged file that belongs to that track.
  6. The matched file is post-processed/tagged/moved using that track’s metadata.

This PR does not make torrents download per-track. It fixes the current per-track staging handoff by teaching it to understand RuTracker-style release filenames like Artist_-_Title and NN - Artist - Title.

Longer term, the better architecture would be an album-level manifest matcher:

  • build a manifest from all downloaded files
  • compare the whole manifest once against the expected album tracklist
  • assign file → track mappings globally
  • let per-track post-processing consume those explicit assignments

That would better handle weak filenames, duplicate compilation tracks, durations, disc numbers, and partial/extra files. This PR intentionally avoids that larger redesign and keeps scope limited to making the existing post-download handoff work for common RuTracker album releases.

@Zombiehamser

Copy link
Copy Markdown

Sorry, my question is a bit off-topic. However, I can’t help but ask: how do you use rutracker? Prowlarr can’t bypass Cloudflare protection, even with additional plugins.

@ramonskie

Copy link
Copy Markdown
Contributor Author

rutracker works perfectly fine with flaresolver.
here is some documentation https://github.com/ramonskie/groovearr/blob/main/docs/prowlarr-integration.md

but soulsync can never really work. as at its core it does per track searching.
i wrote my own app. that does make a distinction between full albums and per track.
and with fallback mechanisms. that perfectly integrates with rutracker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants