diff --git a/client/pages/audiobook/_id/chapters.vue b/client/pages/audiobook/_id/chapters.vue
index 1f58d9b0..52cb1bbc 100644
--- a/client/pages/audiobook/_id/chapters.vue
+++ b/client/pages/audiobook/_id/chapters.vue
@@ -21,13 +21,14 @@
+
-
{{ $strings.ButtonShiftTimes }}
-
{{ $strings.ButtonLookup }}
+
{{ $strings.ButtonRemoveAll }}
+
{{ $strings.ButtonShiftTimes }}
+
{{ $strings.ButtonLookup }}
-
{{ $strings.ButtonReset }}
-
{{ $strings.ButtonSave }}
+
{{ $strings.ButtonReset }}
+
{{ $strings.ButtonSave }}
@@ -588,6 +589,45 @@ export default {
]
}
this.checkChapters()
+ },
+ removeAllChaptersClick() {
+ const payload = {
+ message: this.$strings.MessageConfirmRemoveAllChapters,
+ callback: (confirmed) => {
+ if (confirmed) {
+ this.removeAllChapters()
+ }
+ },
+ type: 'yesNo'
+ }
+ this.$store.commit('globals/setConfirmPrompt', payload)
+ },
+ removeAllChapters() {
+ this.saving = true
+ const payload = {
+ chapters: []
+ }
+ this.$axios
+ .$post(`/api/items/${this.libraryItem.id}/chapters`, payload)
+ .then((data) => {
+ if (data.updated) {
+ this.$toast.success('Chapters removed')
+ if (this.previousRoute) {
+ this.$router.push(this.previousRoute)
+ } else {
+ this.$router.push(`/item/${this.libraryItem.id}`)
+ }
+ } else {
+ this.$toast.info(this.$strings.MessageNoUpdatesWereNecessary)
+ }
+ })
+ .catch((error) => {
+ console.error('Failed to remove chapters', error)
+ this.$toast.error('Failed to remove chapters')
+ })
+ .finally(() => {
+ this.saving = false
+ })
}
},
mounted() {
diff --git a/client/strings/de.json b/client/strings/de.json
index 28b859d6..4cac3511 100644
--- a/client/strings/de.json
+++ b/client/strings/de.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "Sind Sie sicher, dass Sie einen erneuten Scanvorgang erzwingen wollen?",
"MessageConfirmMarkSeriesFinished": "Sind Sie sicher, dass Sie alle Medien dieser Reihe als abgeschlossen markieren wollen?",
"MessageConfirmMarkSeriesNotFinished": "Sind Sie sicher, dass Sie alle Medien dieser Reihe als nicht abgeschlossen markieren wollen?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "Sind Sie sicher, dass Sie die Sammlung \"{0}\" löschen wollen?",
"MessageConfirmRemoveEpisode": "Sind Sie sicher, dass Sie die Episode \"{0}\" löschen möchten?",
"MessageConfirmRemoveEpisodes": "Sind Sie sicher, dass Sie {0} Episoden löschen wollen?",
diff --git a/client/strings/en-us.json b/client/strings/en-us.json
index 6550a503..1ea2fa27 100644
--- a/client/strings/en-us.json
+++ b/client/strings/en-us.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "Are you sure you want to force re-scan?",
"MessageConfirmMarkSeriesFinished": "Are you sure you want to mark all books in this series as finished?",
"MessageConfirmMarkSeriesNotFinished": "Are you sure you want to mark all books in this series as not finished?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "Are you sure you want to remove collection \"{0}\"?",
"MessageConfirmRemoveEpisode": "Are you sure you want to remove episode \"{0}\"?",
"MessageConfirmRemoveEpisodes": "Are you sure you want to remove {0} episodes?",
diff --git a/client/strings/es.json b/client/strings/es.json
index bb2a224d..17c13698 100644
--- a/client/strings/es.json
+++ b/client/strings/es.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "Esta seguro que desea forzar re-escanear?",
"MessageConfirmMarkSeriesFinished": "Esta seguro que desea marcar todos los libros en esta serie como terminados?",
"MessageConfirmMarkSeriesNotFinished": "Esta seguro que desea marcar todos los libros en esta serie como no terminados?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "Esta seguro que desea remover la colección \"{0}\"?",
"MessageConfirmRemoveEpisode": "Esta seguro que desea remover el episodio \"{0}\"?",
"MessageConfirmRemoveEpisodes": "Esta seguro que desea remover {0} episodios?",
diff --git a/client/strings/fr.json b/client/strings/fr.json
index 04b6b075..0b03f174 100644
--- a/client/strings/fr.json
+++ b/client/strings/fr.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "Êtes-vous sûr de vouloir lancer une Analyse Forcée ?",
"MessageConfirmMarkSeriesFinished": "Êtes-vous sûr de vouloir marquer comme terminé tous les livres de cette série ?",
"MessageConfirmMarkSeriesNotFinished": "Êtes-vous sûr de vouloir marquer comme non terminé tous les livres de cette série ?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "Êtes-vous sûr de vouloir supprimer la collection « {0} » ?",
"MessageConfirmRemoveEpisode": "Êtes-vous sûr de vouloir supprimer l’épisode « {0} » ?",
"MessageConfirmRemoveEpisodes": "Êtes-vous sûr de vouloir supprimer {0} épisodes ?",
diff --git a/client/strings/hi.json b/client/strings/hi.json
index b146df45..d1dcd1d7 100644
--- a/client/strings/hi.json
+++ b/client/strings/hi.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "Are you sure you want to force re-scan?",
"MessageConfirmMarkSeriesFinished": "Are you sure you want to mark all books in this series as finished?",
"MessageConfirmMarkSeriesNotFinished": "Are you sure you want to mark all books in this series as not finished?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "Are you sure you want to remove collection \"{0}\"?",
"MessageConfirmRemoveEpisode": "Are you sure you want to remove episode \"{0}\"?",
"MessageConfirmRemoveEpisodes": "Are you sure you want to remove {0} episodes?",
@@ -638,4 +639,4 @@
"ToastSocketFailedToConnect": "Socket failed to connect",
"ToastUserDeleteFailed": "Failed to delete user",
"ToastUserDeleteSuccess": "User deleted"
-}
+}
\ No newline at end of file
diff --git a/client/strings/hr.json b/client/strings/hr.json
index 3b9a5d75..69dcef74 100644
--- a/client/strings/hr.json
+++ b/client/strings/hr.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "Jeste li sigurni da želite ponovno skenirati?",
"MessageConfirmMarkSeriesFinished": "Are you sure you want to mark all books in this series as finished?",
"MessageConfirmMarkSeriesNotFinished": "Are you sure you want to mark all books in this series as not finished?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "AJeste li sigurni da želite obrisati kolekciju \"{0}\"?",
"MessageConfirmRemoveEpisode": "Jeste li sigurni da želite obrisati epizodu \"{0}\"?",
"MessageConfirmRemoveEpisodes": "Jeste li sigurni da želite obrisati {0} epizoda/-u?",
diff --git a/client/strings/it.json b/client/strings/it.json
index c44dc48a..1eecc3fc 100644
--- a/client/strings/it.json
+++ b/client/strings/it.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "Sei sicuro di voler forzare una nuova scansione?",
"MessageConfirmMarkSeriesFinished": "Sei sicuro di voler contrassegnare tutti i libri di questa serie come completati?",
"MessageConfirmMarkSeriesNotFinished": "Sei sicuro di voler contrassegnare tutti i libri di questa serie come non completati?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "Sei sicuro di voler rimuovere la Raccolta \"{0}\"?",
"MessageConfirmRemoveEpisode": "Sei sicuro di voler rimuovere l'episodio \"{0}\"?",
"MessageConfirmRemoveEpisodes": "Sei sicuro di voler rimuovere {0} episodi?",
diff --git a/client/strings/pl.json b/client/strings/pl.json
index 8d07bd64..ed0ba345 100644
--- a/client/strings/pl.json
+++ b/client/strings/pl.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "Czy na pewno chcesz wymusić ponowne skanowanie?",
"MessageConfirmMarkSeriesFinished": "Are you sure you want to mark all books in this series as finished?",
"MessageConfirmMarkSeriesNotFinished": "Are you sure you want to mark all books in this series as not finished?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "Czy na pewno chcesz usunąć kolekcję \"{0}\"?",
"MessageConfirmRemoveEpisode": "Czy na pewno chcesz usunąć odcinek \"{0}\"?",
"MessageConfirmRemoveEpisodes": "Czy na pewno chcesz usunąć {0} odcinki?",
diff --git a/client/strings/ru.json b/client/strings/ru.json
index c172df99..0e0871eb 100644
--- a/client/strings/ru.json
+++ b/client/strings/ru.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "Вы уверены, что хотите принудительно выполнить повторное сканирование?",
"MessageConfirmMarkSeriesFinished": "Вы уверены, что хотите отметить все книги этой серии как законченные?",
"MessageConfirmMarkSeriesNotFinished": "Вы уверены, что хотите отметить все книги этой серии как незаконченные?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "Вы уверены, что хотите удалить коллекцию \"{0}\"?",
"MessageConfirmRemoveEpisode": "Вы уверены, что хотите удалить эпизод \"{0}\"?",
"MessageConfirmRemoveEpisodes": "Вы уверены, что хотите удалить {0} эпизодов?",
diff --git a/client/strings/zh-cn.json b/client/strings/zh-cn.json
index afc21c05..3a9b0c9c 100644
--- a/client/strings/zh-cn.json
+++ b/client/strings/zh-cn.json
@@ -465,6 +465,7 @@
"MessageConfirmForceReScan": "你确定要强制重新扫描吗?",
"MessageConfirmMarkSeriesFinished": "你确定要将此系列中的所有书籍都标记为已听完吗?",
"MessageConfirmMarkSeriesNotFinished": "你确定要将此系列中的所有书籍都标记为未听完吗?",
+ "MessageConfirmRemoveAllChapters": "Are you sure you want to remove all chapters?",
"MessageConfirmRemoveCollection": "您确定要移除收藏 \"{0}\"?",
"MessageConfirmRemoveEpisode": "您确定要移除剧集 \"{0}\"?",
"MessageConfirmRemoveEpisodes": "你确定要移除 {0} 剧集?",
diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js
index 05aee92d..d26f57f2 100644
--- a/server/controllers/LibraryItemController.js
+++ b/server/controllers/LibraryItemController.js
@@ -436,12 +436,12 @@ class LibraryItemController {
return res.sendStatus(500)
}
- const chapters = req.body.chapters || []
- if (!chapters.length) {
+ if (!req.body.chapters) {
Logger.error(`[LibraryItemController] Invalid payload`)
return res.sendStatus(400)
}
+ const chapters = req.body.chapters || []
const wasUpdated = req.libraryItem.media.updateChapters(chapters)
if (wasUpdated) {
await this.db.updateLibraryItem(req.libraryItem)