Skip to content

Bulk import: scan a folder and import everything matched (manual import is one-path-at-a-time) #1292

Description

@vavallee

Problem

Manual Import / Migrate "Look Up" is strictly one path → one book, which makes importing an existing library brutal. A Discord user with 591 unmatched files has to repeat: expand unmatched files → copy a folder path → paste into Import/Migrate → Look Up → pick the book → import. 591 times.

Two specific rough edges feed this:

  1. Pointing Look Up at an author/collection folder returns one bogus match, not the books inside it. Scanner.Lookup only parses filepath.Base(path) (internal/importer/lookup.go:36parser.go ParseFilename) and never recurses. Pasting /Data/Media/Books/Terry Pratchett/ parses the string "Terry Pratchett" as a single title and fuzzy-matches it to whatever one catalogue title is closest. It never sees the book subfolders. The user has to paste each individual book folder.

  2. No "import everything matched under here" path. POST /api/v1/queue/manual-import takes a single path + single bookId (internal/api/manual_import.go:87). The tree-walking importers don't fill this gap: ABS import is remote-API-only, and library scan only reconciles existing catalogue books (it lists unmatched files but doesn't import them).

Proposed design (sketch)

A directory-scan manual import:

  • New endpoint, e.g. GET /queue/manual-import/scan?path=... (admin-only, library-root contained like the existing lookup): walk one or two levels under the pasted folder, group files into book units (reuse the importer's folder grouping), ParseFilename + catalogue-match each, and return a list of per-unit results: { path, parsedTitle/Author, match: confident|ambiguous|none, book|candidates }.
  • Frontend (web/src/pages/settings/ImportTab.tsx): render the list with a row per book — confident pre-selected, ambiguous with a candidate picker, none skipped — and a "Import N selected" button.
  • Batch import endpoint (or loop the existing single import server-side) to commit the selected (path, bookId) pairs in one request, with a summary.
  • Stretch: a dry-run/preview count and an "auto-import all confident" shortcut.

Related

Filing as a feature (not folding into the dash fix) because it needs a new response shape, batch endpoint, and UI. Happy to implement on the green light.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions