mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-22 19:59:37 +00:00
Add api to update all metadata files
This commit is contained in:
parent
6ac0a8a678
commit
736a939284
2 changed files with 22 additions and 0 deletions
|
|
@ -150,6 +150,27 @@ class ToolsController {
|
|||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
/**
|
||||
* POST: /api/tools/batch/update-metadata-files
|
||||
* Start batch request to update all metadata files
|
||||
*
|
||||
* @this import('../routers/ApiRouter')
|
||||
*
|
||||
* @param {RequestWithUser} req
|
||||
* @param {Response} res
|
||||
*/
|
||||
async updateAllItemMetadata(req, res) {
|
||||
if (!req.user.isAdminOrUp) {
|
||||
Logger.warn(`Non-admin user "${req.user.username}" other than admin attempted to batch scan library items`)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
|
||||
const libraryItems = await Database.libraryItemModel.findAll()
|
||||
for (const libraryItem of libraryItems) await libraryItem.saveMetadataFile()
|
||||
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {RequestWithUser} req
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue