Skip to content

feat(streamio): add POST /api/nzb/stremio-streams endpoint - #372

Merged
javi11 merged 7 commits into
mainfrom
claude/nzb-stremio-endpoint-ZVVHN
Mar 3, 2026
Merged

feat(streamio): add POST /api/nzb/stremio-streams endpoint#372
javi11 merged 7 commits into
mainfrom
claude/nzb-stremio-endpoint-ZVVHN

Conversation

@javi11

@javi11 javi11 commented Feb 27, 2026

Copy link
Copy Markdown
Collaborator

New public endpoint that accepts an NZB file upload, processes it
synchronously through the high-priority import queue, and returns
Stremio-compatible stream URLs for all media files in the NZB output.

Authentication is via download_key (SHA256 of user API key), matching
the existing stream handler auth model so Stremio addons can be
pre-configured without browser-based JWT auth.

Response format:
{
"streams": [{ "url": "...", "title": "file.mkv", "name": "filename" }],
"_queue_item_id": 123,
"_queue_status": "completed"
}

Parameters (multipart form):

  • file: .nzb file (required)
  • download_key: SHA256 of API key (required)
  • base_url: server base URL for stream URLs (optional, auto-detected)
  • category: NZB category (optional)
  • timeout: processing timeout in seconds (optional, default 300)

New public endpoint that accepts an NZB file upload, processes it
synchronously through the high-priority import queue, and returns
Stremio-compatible stream URLs for all media files in the NZB output.

Authentication is via download_key (SHA256 of user API key), matching
the existing stream handler auth model so Stremio addons can be
pre-configured without browser-based JWT auth.

Response format:
  {
    "streams": [{ "url": "...", "title": "file.mkv", "name": "AltMount" }],
    "_queue_item_id": 123,
    "_queue_status": "completed"
  }

Parameters (multipart form):
  - file: .nzb file (required)
  - download_key: SHA256 of API key (required)
  - base_url: server base URL for stream URLs (optional, auto-detected)
  - category: NZB category (optional)
  - timeout: processing timeout in seconds (optional, default 300)

https://claude.ai/code/session_01NBXpeHpXVJAU3VRy5qw6ZS
The Name field in the Stremio stream response now uses the uploaded NZB
filename (without extension) instead of the hardcoded "AltMount" string.

https://claude.ai/code/session_01NBXpeHpXVJAU3VRy5qw6ZS
Before saving and queuing an NZB, check the queue for an existing entry
with the same filename:

- Completed with storage path → return cached stream URLs immediately
- Active (pending/processing/paused) → attach to the existing item and
  poll it, avoiding a duplicate queue entry

Polling logic is extracted into pollAndRespond() to be shared by both
the normal and the active-join paths.

https://claude.ai/code/session_01NBXpeHpXVJAU3VRy5qw6ZS
New field: api.stremio_nzb_ttl_hours (default: 24).

Controls how long a completed NZB result returned by
POST /api/nzb/stremio-streams is considered valid. When the same NZB
filename is uploaded again and the previous completion is within the
TTL window, the cached stream URLs are returned immediately without
re-processing.

Set to 0 to disable expiry and cache results forever.

https://claude.ai/code/session_01NBXpeHpXVJAU3VRy5qw6ZS
@javi11 javi11 changed the title add POST /api/nzb/stremio-streams endpoint feat(streamio): add POST /api/nzb/stremio-streams endpoint Feb 27, 2026
@javi11
javi11 marked this pull request as draft February 27, 2026 23:17
claude and others added 3 commits March 1, 2026 12:04
…riven completion

- Move Stremio config out of APIConfig into a new StremioConfig section
  (enabled: false by default, nzb_ttl_hours: 24)
- POST /api/nzb/stremio-streams renamed to POST /api/nzb/streams
- Handler gates on Stremio.Enabled; returns 404 when disabled
- Replace the 2-second poll loop with broadcaster subscription:
  - Add Status field and NotifyComplete() to ProgressBroadcaster
  - Importer service calls NotifyComplete("completed"/"failed") on terminal states
  - waitAndRespond() subscribes once and selects on the channel + timeout timer
- Add "stremio" to the config PATCH section switch
- Frontend: add StremioConfig interface, StremioConfigSection component,
  wire into ConfigurationPage under the Automation group

https://claude.ai/code/session_01NBXpeHpXVJAU3VRy5qw6ZS
Add a dedicated Stremio integration guide covering the POST /api/nzb/streams
endpoint, download_key derivation, configuration options (stremio.enabled,
nzb_ttl_hours), response format, caching behaviour, and a full curl example.

Also update the intro page (feature bullet + Next Steps link) and the API
endpoints table to surface the new Stremio category.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@javi11
javi11 marked this pull request as ready for review March 3, 2026 16:48
@javi11
javi11 merged commit 24e6025 into main Mar 3, 2026
1 check passed
yoshitaka420 pushed a commit to yoshitaka420/altmount that referenced this pull request Jun 1, 2026
…#372)

* add POST /api/nzb/stremio-streams endpoint

New public endpoint that accepts an NZB file upload, processes it
synchronously through the high-priority import queue, and returns
Stremio-compatible stream URLs for all media files in the NZB output.

Authentication is via download_key (SHA256 of user API key), matching
the existing stream handler auth model so Stremio addons can be
pre-configured without browser-based JWT auth.

Response format:
  {
    "streams": [{ "url": "...", "title": "file.mkv", "name": "AltMount" }],
    "_queue_item_id": 123,
    "_queue_status": "completed"
  }

Parameters (multipart form):
  - file: .nzb file (required)
  - download_key: SHA256 of API key (required)
  - base_url: server base URL for stream URLs (optional, auto-detected)
  - category: NZB category (optional)
  - timeout: processing timeout in seconds (optional, default 300)
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