Skip to content

feat(strm): one-click STRM generation (progress-tracked task + admin endpoint)#9556

Open
okatu-loli wants to merge 8 commits into
AlistGo:mainfrom
okatu-loli:feat/strm-generate-button
Open

feat(strm): one-click STRM generation (progress-tracked task + admin endpoint)#9556
okatu-loli wants to merge 8 commits into
AlistGo:mainfrom
okatu-loli:feat/strm-generate-button

Conversation

@okatu-loli

Copy link
Copy Markdown
Collaborator

What

Adds one-click STRM generation to the Strm driver: an explicit, progress-tracked, repeatable action that walks a mount (or any subdirectory) and writes .strm/local files to disk — instead of relying only on lazy generation during directory browsing.

Changes

  • GenerateLocal (two-phase, progress) — refactors the tree walk into a reusable, cancellable, two-phase implementation: phase 1 scans via fs.List to count units, phase 2 writes files and reports progress. Exposed through a new internal/driver.StrmGenerator interface to avoid an import cycle (internal/fs → driver package).
  • StrmGenerateTask + manager — a non-persisted tache task (3 workers) registered in bootstrap; resolves the Strm driver by mount path via type assertion and calls GenerateLocal with SetProgress.
  • Admin endpoint POST /api/admin/strm/generate { path } — validates the target is a Strm storage with SaveStrmLocalPath configured, enqueues the task, returns the task id for progress polling.
  • rotateAllLocal unified with the same walk (drops the duplicate walkAndSync); cancellation supported via context.

Notes

  • Admin-only (writes to server local disk). Works even if SaveStrmToLocal is off, since it's an explicit action.
  • Override mode uses the storage's configured SaveLocalMode (insert/update/sync).
  • Sign handling is unchanged — .strm lines go through the same buildStrmLine/generateSign path; ?sign= is appended iff the storage's WithSign is enabled.
  • Frontend (button + inline progress + task center) is in a companion alist-web PR.

…nterface

Introduces driver.StrmGenerator interface in internal/driver/strm.go so
internal/fs can call GenerateLocal without importing the driver package.
Adds resolveStarts/collectUnits/generateUnits helpers and the GenerateLocal
method on *Strm; moves the SaveStrmToLocal toggle guard out of
syncLocalDirWithMode (into syncLocalDir only) so manual generation works
when the toggle is off as long as SaveStrmLocalPath is set.
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.

1 participant