From 655bebfec4c6ba71751a7aa4a0f3e7af7f5e4789 Mon Sep 17 00:00:00 2001 From: Teekeks Date: Tue, 27 Feb 2024 18:30:05 +0100 Subject: [PATCH] feat: Expanded filter to include "has no ebook" and "has no supplementary ebooks" options --- client/components/controls/LibraryFilterSelect.vue | 8 ++++++++ client/strings/de.json | 2 ++ client/strings/en-us.json | 2 ++ server/utils/queries/libraryItemsBookFilters.js | 8 ++++++++ 4 files changed, 20 insertions(+) diff --git a/client/components/controls/LibraryFilterSelect.vue b/client/components/controls/LibraryFilterSelect.vue index 5ed4400b..04dd11af 100644 --- a/client/components/controls/LibraryFilterSelect.vue +++ b/client/components/controls/LibraryFilterSelect.vue @@ -368,9 +368,17 @@ export default { id: 'ebook', name: this.$strings.LabelHasEbook }, + { + id: 'no-ebook', + name: this.$strings.LabelMissingEbook + }, { id: 'supplementary', name: this.$strings.LabelHasSupplementaryEbook + }, + { + id: 'no-supplementary', + name: this.$strings.LabelMissingSupplementaryEbook } ] }, diff --git a/client/strings/de.json b/client/strings/de.json index 5b2711c1..33b0fb1b 100644 --- a/client/strings/de.json +++ b/client/strings/de.json @@ -356,7 +356,9 @@ "LabelMetaTags": "Meta Tags", "LabelMinute": "Minute", "LabelMissing": "Fehlend", + "LabelMissingEbook": "E-Book fehlt", "LabelMissingParts": "Fehlende Teile", + "LabelMissingSupplementaryEbook": "Ergänzendes E-Book fehlt", "LabelMobileRedirectURIs": "Erlaubte Weiterleitungs-URIs für die mobile App", "LabelMobileRedirectURIsDescription": "Dies ist eine Whitelist gültiger Umleitungs-URIs für mobile Apps. Der Standardwert ist audiobookshelf://oauth, den du entfernen oder durch zusätzliche URIs für die Integration von Drittanbieter-Apps ergänzen kannst. Die Verwendung eines Sternchens (*) als alleiniger Eintrag erlaubt jede URI.", "LabelMore": "Mehr", diff --git a/client/strings/en-us.json b/client/strings/en-us.json index b8860ffa..2465f873 100644 --- a/client/strings/en-us.json +++ b/client/strings/en-us.json @@ -356,7 +356,9 @@ "LabelMetaTags": "Meta Tags", "LabelMinute": "Minute", "LabelMissing": "Missing", + "LabelMissingEbook": "Has no ebook", "LabelMissingParts": "Missing Parts", + "LabelMissingSupplementaryEbook": "Has no supplementary ebook", "LabelMobileRedirectURIs": "Allowed Mobile Redirect URIs", "LabelMobileRedirectURIsDescription": "This is a whitelist of valid redirect URIs for mobile apps. The default one is audiobookshelf://oauth, which you can remove or supplement with additional URIs for third-party app integration. Using an asterisk (*) as the sole entry permits any URI.", "LabelMore": "More", diff --git a/server/utils/queries/libraryItemsBookFilters.js b/server/utils/queries/libraryItemsBookFilters.js index d23459b4..16a25847 100644 --- a/server/utils/queries/libraryItemsBookFilters.js +++ b/server/utils/queries/libraryItemsBookFilters.js @@ -204,6 +204,10 @@ module.exports = { mediaWhere['ebookFile'] = { [Sequelize.Op.not]: null } + } else if (value == 'no-ebook') { + mediaWhere['ebookFile'] = { + [Sequelize.Op.eq]: null + } } } else if (group === 'missing') { if (['asin', 'isbn', 'subtitle', 'publishedYear', 'description', 'publisher', 'language', 'cover'].includes(value)) { @@ -421,6 +425,10 @@ module.exports = { libraryItemWhere['libraryFiles'] = { [Sequelize.Op.substring]: `"isSupplementary":true` } + } else if (filterGroup === 'ebooks' && filterValue === 'no-supplementary') { + libraryItemWhere['libraryFiles'] = { + [Sequelize.Op.notLike]: Sequelize.literal(`\'%"isSupplementary":true%\'`), + } } else if (filterGroup === 'missing' && filterValue === 'authors') { authorInclude = { model: Database.authorModel,