diff --git a/client/components/modals/BatchQuickMatchModel.vue b/client/components/modals/BatchQuickMatchModel.vue
index d02c39f4..c424baaa 100644
--- a/client/components/modals/BatchQuickMatchModel.vue
+++ b/client/components/modals/BatchQuickMatchModel.vue
@@ -10,7 +10,39 @@
Quick Match {{ selectedBookIds.length }} Books
-
+
+
+
+
+
+
+
+
+ Update Covers
+ info_outlined
+
+
+
+
+
+
+
+ Update Details
+ info_outlined
+
+
+
+
+
@@ -20,7 +52,16 @@
export default {
data() {
return {
- processing: false
+ processing: false,
+ options: {
+ provider: 'google',
+ overrideDetails: true,
+ overrideCover: true
+ },
+ tooltips: {
+ updateCovers: 'Update the selected book covers when a match is located.',
+ updateDetails: 'Update the selected book details when a match is located.'
+ }
}
},
computed: {
@@ -45,26 +86,40 @@ export default {
},
currentLibraryId() {
return this.$store.state.libraries.currentLibraryId
+ },
+ providers() {
+ if (this.isPodcast) return this.$store.state.scanners.podcastProviders
+ return this.$store.state.scanners.providers
}
},
methods: {
+ doBatchQuickMatch() {
+ if (!this.selectedBookIds.length) return
+ if (this.processing) return
+
+ this.processing = true
+ this.$store.commit('setProcessingBatch', true)
+ this.$axios
+ .$post(`/api/items/batch/quickmatch`, {
+ options: this.options,
+ libraryItemIds: this.selectedBookIds
+ })
+ .then(() => {
+ this.$toast.success('Batch quick match success!')
+ this.processing = false
+ this.$store.commit('setProcessingBatch', false)
+ this.show = false
+ })
+ .catch((error) => {
+ this.$toast.error('Batch quick match failed')
+ console.error('Failed to batch quick match', error)
+ this.processing = false
+ this.$store.commit('setProcessingBatch', false)
+ this.show = false
+ })
+ }
},
mounted() {}
}
-
\ No newline at end of file
diff --git a/client/layouts/default.vue b/client/layouts/default.vue
index 3e4202f2..89be096e 100644
--- a/client/layouts/default.vue
+++ b/client/layouts/default.vue
@@ -15,6 +15,7 @@
+
diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js
index 328e75a5..9eba9cc6 100644
--- a/server/controllers/LibraryItemController.js
+++ b/server/controllers/LibraryItemController.js
@@ -305,6 +305,31 @@ class LibraryItemController {
res.json(libraryItems)
}
+ // POST: api/items/batch/quickmatch
+ async batchQuickMatch(req, res) {
+ var itemsUpdated = 0
+
+ var matchData = req.body
+ var options = matchData.options || {}
+ var items = matchData.libraryItemIds
+ if (!items || !items.length) {
+ return res.sendStatus(500)
+ }
+
+ for (let i = 0; i < items.length; i++) {
+ var libraryItem = this.db.libraryItems.find(_li => _li.id === items[i])
+ var matchResult = await this.scanner.quickMatchLibraryItem(libraryItem, options)
+ if (matchResult.updated) {
+ itemsUpdated++
+ }
+ }
+
+ res.json({
+ success: itemsUpdated > 0,
+ updates: itemsUpdated
+ })
+ }
+
// DELETE: api/items/all
async deleteAll(req, res) {
if (!req.user.isAdminOrUp) {
diff --git a/server/routers/ApiRouter.js b/server/routers/ApiRouter.js
index edb293df..27b8233c 100644
--- a/server/routers/ApiRouter.js
+++ b/server/routers/ApiRouter.js
@@ -101,6 +101,7 @@ class ApiRouter {
this.router.post('/items/batch/delete', LibraryItemController.batchDelete.bind(this))
this.router.post('/items/batch/update', LibraryItemController.batchUpdate.bind(this))
this.router.post('/items/batch/get', LibraryItemController.batchGet.bind(this))
+ this.router.post('/items/batch/quickmatch', LibraryItemController.batchQuickMatch.bind(this))
//
// User Routes