Skip to content

Additive scene filenames endpoint (append without full replace) - #2277

Open
moToroTor wants to merge 1 commit into
xbapps:masterfrom
moToroTor:feature/scene-filenames-append-pristine
Open

moToroTor wants to merge 1 commit into
xbapps:masterfrom
moToroTor:feature/scene-filenames-append-pristine

Conversation

@moToroTor

Copy link
Copy Markdown

Adds POST /api/scene/filenames/{scene-id}, which merges basenames into the scene's filenames array without touching any other field.

Motivation: the only write path today is POST /api/scene/edit/{scene-id}, which overwrites every field it receives. External tools (e.g. download managers that know the expected filename for a scene ahead of the next library scan) have no way to register a filename non-destructively — they must GET the full scene, merge, and POST it all back.

Behavior:

  • Request body {"filenames": [...]}; new names are appended, pre-existing entries untouched.
  • Idempotent: re-appending the same name is an exact-match no-op (same == comparison the scan matcher uses).
  • Encoding goes through encoding/json, identical to the scan write path, so the LIKE matcher keeps matching.
  • Audit + index: AddAction entry on change and a search-index refresh, same as an edit.
  • Errors: missing key 400, unknown scene id 404, corrupt stored list 500 with no write.
  • A package mutex serializes concurrent appends so read-modify-write cannot lose entries.

Includes pkg/api/scenes_filenames_test.go covering append, idempotency, and the error cases. No changes to scan, edit, or scrapers.

POST /filenames/{scene-id} with {"filenames": [...]} merges basenames
into Scene.FilenamesArr with exact-match dedupe, json.Marshal encoding
identical to the scan matcher write path, AddAction audit on change, and
search-index refresh. Missing key 400s, bad ids 404, corrupt stored JSON
500s without write; a package mutex serializes concurrent appends.

Assisted-By: muse-spark-1.3
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