Feature/download client media eligibility - #2633
Open
niddelicious wants to merge 3 commits into
Open
niddelicious wants to merge 3 commits into
niddelicious wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
niddelicious
force-pushed
the
feature/download-client-media-eligibility
branch
from
September 16, 2026 11:30
25dd717 to
ea77ce7
Compare
Signed-off-by: niddelicious <github@nidde.nu>
Signed-off-by: niddelicious <github@nidde.nu>
Signed-off-by: niddelicious <github@nidde.nu>
niddelicious
force-pushed
the
feature/download-client-media-eligibility
branch
from
September 16, 2026 11:31
ea77ce7 to
6fae8c9
Compare
vavallee
requested changes
Sep 17, 2026
vavallee
left a comment
Owner
There was a problem hiding this comment.
Thanks for this, it's a nice feature and the routing itself is solid: both send sites filter, polling and removal still go by client id, the migration is safe, and the tests pass. A few things turned up in review that hit exactly the setups this is for, so I'd like to get them sorted before merging.
Needs fixing
- Readarr import creates clients that are eligible for nothing.
internal/migrate/readarr.goaround line 268 builds amodels.DownloadClientwithout the two new flags, so they go in as false and every grab afterwards fails with "no enabled download client is eligible". Setting both to true there (or defaulting inrepo.Create) fixes it. - Approving a pending release sends audiobooks to the ebook client.
internal/api/pending.goaround line 180 uses the book's media type, which isbothfor a dual format book, andFilterEligibleForMediaTypetreats anything that isn'taudiobookas books. The pending release row has its ownMediaType; using that routes it correctly. That bug predates your PR, but the eligibility filter is what turns it into a misroute. SendWithFallbackcan send the same release to two clients. It moves on after any error, but several errors happen after the first client already accepted the download: Transmission returning id 0, qBittorrent with no hash, SABnzbd with no NZO id, or a timeout reading the qBittorrent response. The torrent then lands in both clients and the first copy is never tracked. I'd either drop the fallback (use the top ranked eligible client and report its error) or only fall through on errors that prove nothing was sent, like a connection refused before the request.
Worth doing here or as a follow up
- Auto-grab doesn't look at the other protocol.
scheduler.goaround line 1031 picks the best release across both protocols first, then gives up if that protocol has no eligible client. With SABnzbd set to ebooks only and qBittorrent to audiobooks only, a usenet audiobook that ranks best means the sweep logs "no eligible download client" and ignores the approved torrent, every sweep. Filtering candidates to protocols that have an eligible client before choosing would fix it. The manual grab error also tells you to "enable a download client for audiobooks" when one already exists for the other protocol. - Grabs from the free-text Search page always count as books. Results there have no media type, so an m4b torrent found on /search goes to the ebook client. Book detail and Wanted are fine because they fall back to the book's type.
- Priority now sorts ahead of the category hint in
RankClientsForMediaType. That's reasonable, but it can change which client an existing install uses, so a line in the changelog fragment would help.
Housekeeping
- The red CodeQL check isn't you. Those three alerts are already open on main at the same lines; CodeQL blames this PR because the client URL input moved in
download_clients.go. 086collides with other open PRs (#2607, #2626, #2628). Whichever lands later renumbers, so no action yet.- This will go into v1.37 rather than a patch release.
Happy to help with any of these if you get stuck.
This was referenced Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added functionality to make download clients eligible/non-eligible for different media type (determined by index search), making any grab filter out any clients not enabled for the grabbed type.
Priority field for download clients is enabled in frontend and after filtering any eligible client is processed in priority order.
Origin for this feature was my personal need to pass books to one Transmission instance and audiobooks to a different Transmission instance.
Checklist
git commit -s— see Sign your workdocs/DEPLOYMENT.mdupdated if env vars, config, or upgrade path changedchangelog.d/(not an edit toCHANGELOG.md) — see changelog.d/README.mdTest plan
make check(or the individualgo test ./cmd/... ./internal/...andcd web && npm run buildsteps)