Expose a SABnzbd-compatible download client - #38
Merged
Conversation
) Closes the *arr round-trip: Sonarr grabs a release from the Newznab indexer, hands the synthetic NZB to its download client (us), and we decode the opaque token back into a real download job. Part 3 of the *arr API-surface plan. - SABnzbd API on the NewznabIndexerApi host (mode=version|get_config|addfile|addurl| queue|history + queue/history delete). addfile/addurl decode the krautwatch-token from the NZB/link → AddDownloadByTokenHandler resolves the episode's best stream, creates a DownloadJob and enqueues it (via the existing IDownloadQueue port — no Wolverine needed here). queue/history project DownloadJob state (split by a new Active flag on DownloadJobResponse). - Application/Downloads: NzbToken (the shared krautwatch-token codec, now the single source of truth the indexer's NZB writer also uses) + AddDownloadByTokenHandler. - One instance apikey (Krautwatch:ApiKey) shared by both surfaces via ApiKeyGuard; Newznab caps stays open. Actual stream pulling stays the Downloader agent's job (future work) — the client persists + enqueues the intent. ./build.cmd Test green (Application 44). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What & why
Closes the Sonarr/Radarr round-trip (DR-010): Sonarr grabs a release from the Newznab indexer (#37), hands the synthetic NZB to its download client — us — and we decode the opaque token back into a real download job. Part 3 of the *arr API-surface plan.
Changes
SABnzbd API on the existing
NewznabIndexerApihost (one host, both protocols):mode=version | get_config | addfile | addurl | queue | history(+ queue/historydelete).addfile/addurldecode thekrautwatch-tokenfrom the NZB/link →AddDownloadByTokenHandlerresolves the episode's best stream, creates aDownloadJoband enqueues it via the existingIDownloadQueueport (no Wolverine needed here).queue/historyprojectDownloadJobstate, split by a newActiveflag onDownloadJobResponse.Application/Downloads:
NzbToken— the sharedkrautwatch-tokencodec, now the single source of truth the indexer's NZB writer also uses — plusAddDownloadByTokenHandler.Auth: one instance apikey (
Krautwatch:ApiKey) shared by both surfaces viaApiKeyGuard; Newznabcapsstays open for Prowlarr.Scope
Actual stream pulling stays the Downloader agent's job (future work) — this client persists + enqueues the intent, which is the SABnzbd contract Sonarr speaks to. So a live end-to-end grab-to-file needs the Downloader; the client protocol itself is complete and unit-tested here.
Tests
NzbTokenround-trip (reads the token back out of the indexer's NZB shape; rejects malformed/absent) andAddDownloadByTokenHandler(known token enqueues; unknown/streamless → null, nothing enqueued)../build.cmd Testgreen (Application 44 / Architecture 8 / Infrastructure 47).Next
PR 4 — internal-API cleanup: collapse
PublicApiinto the Blazor config UI (in-process) and delete theApiproject, moving migration ownership to a dedicated migrator.🤖 Generated with Claude Code