mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-28 21:19:42 +00:00
2.1 KiB
2.1 KiB
Batch Reset Metadata Specification
Overview
The "Batch Reset Metadata" feature allows users to reset the metadata for multiple selected library items (books, podcasts, etc.) at once. This action reverts the items' metadata to what is found in the file system (tags, folder structure, OPF files), removing any manual edits stored in the database or metadata.json files.
Date
2026-02-15
User Interface
Frontend
- Component:
client/components/app/Appbar.vue - Trigger: Context menu in the selection mode app bar (when multiple items are selected).
- Visibility:
- Available when multiple items are selected.
- Only available if the user has "Update" permissions.
- Interaction:
- Clicking "Reset Metadata" triggers a confirmation dialog.
- Confirmation Message: "Are you sure you want to reset metadata for ${n} items? This will remove metadata files and re-scan the items from files."
- Action: detailed in Backend Logic.
- Feedback:
- Success: Toast notification "Batch reset metadata successful".
- Failure: Error toast notification.
Backend Logic
Controller
- Controller:
LibraryItemController - Method:
batchResetMetadata(req, res) - Logic:
- Permission Check: Verify
req.user.canUpdate. Return 403 if not. - Input Validation: Check
libraryItemIdsarray in body. - Retrieve Items: Fetch items by IDs.
- Process Loop: Iterate through each item:
- Remove Server Metadata: Delete
/metadata/items/<id>/metadata.jsonif exists. - Remove Local Metadata: Delete
<item_path>/metadata.jsonif exists (and not a single file item). - Reset Cover: Set
media.coverPathtonull. - Re-Scan: Trigger
LibraryItemScanner.scanLibraryItem(id).
- Remove Server Metadata: Delete
- Response: JSON object
{ success: true, results: [...] }.
- Permission Check: Verify
API Router
- Route:
POST /api/items/batch/reset-metadata - Handler:
LibraryItemController.batchResetMetadata
Artifacts
- This specification is saved as
artifacts/2026-02-15/batch_reset.md.