Fix:Check if book is already being merged before allowing to start #3331

This commit is contained in:
advplyr 2024-08-25 17:13:09 -05:00
parent 159ccd807f
commit c72eac9987

View File

@ -29,12 +29,17 @@ class ToolsController {
if (req.libraryItem.mediaType !== 'book') {
Logger.error(`[MiscController] encodeM4b: Invalid library item ${req.params.id}: not a book`)
return res.status(500).send('Invalid library item: not a book')
return res.status(400).send('Invalid library item: not a book')
}
if (req.libraryItem.media.tracks.length <= 0) {
Logger.error(`[MiscController] encodeM4b: Invalid audiobook ${req.params.id}: no audio tracks`)
return res.status(500).send('Invalid audiobook: no audio tracks')
return res.status(400).send('Invalid audiobook: no audio tracks')
}
if (this.abMergeManager.getPendingTaskByLibraryItemId(req.libraryItem.id)) {
Logger.error(`[MiscController] encodeM4b: Audiobook ${req.params.id} is already in queue or processing`)
return res.status(400).send('Audiobook is already in queue or processing')
}
const options = req.query || {}