From 469278cd1e8966611106e07cd6a288de4efb8ea0 Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 12 Apr 2022 16:54:52 -0500 Subject: [PATCH] Fix:Global search support podcasts --- client/components/app/BookShelfCategorized.vue | 17 +++++++++++++---- ...iobookSearchCard.vue => ItemSearchCard.vue} | 12 ++++++++---- client/components/controls/GlobalSearch.vue | 18 +++++++++++++++--- client/components/ui/MultiSelectQueryInput.vue | 1 - client/components/ui/QueryInput.vue | 1 - client/pages/library/_library/search.vue | 8 +++++--- server/controllers/LibraryController.js | 2 +- 7 files changed, 42 insertions(+), 17 deletions(-) rename client/components/cards/{AudiobookSearchCard.vue => ItemSearchCard.vue} (91%) diff --git a/client/components/app/BookShelfCategorized.vue b/client/components/app/BookShelfCategorized.vue index 8f395298..2335d040 100644 --- a/client/components/app/BookShelfCategorized.vue +++ b/client/components/app/BookShelfCategorized.vue @@ -103,7 +103,7 @@ export default { }, async setShelvesFromSearch() { var shelves = [] - if (this.results.books) { + if (this.results.books && this.results.books.length) { shelves.push({ id: 'books', label: 'Books', @@ -112,7 +112,16 @@ export default { }) } - if (this.results.series) { + if (this.results.podcasts && this.results.podcasts.length) { + shelves.push({ + id: 'podcasts', + label: 'Podcasts', + type: 'podcast', + entities: this.results.podcasts.map((res) => res.libraryItem) + }) + } + + if (this.results.series && this.results.series.length) { shelves.push({ id: 'series', label: 'Series', @@ -127,7 +136,7 @@ export default { }) }) } - if (this.results.tags) { + if (this.results.tags && this.results.tags.length) { shelves.push({ id: 'tags', label: 'Tags', @@ -141,7 +150,7 @@ export default { }) }) } - if (this.results.authors) { + if (this.results.authors && this.results.authors.length) { shelves.push({ id: 'authors', label: 'Authors', diff --git a/client/components/cards/AudiobookSearchCard.vue b/client/components/cards/ItemSearchCard.vue similarity index 91% rename from client/components/cards/AudiobookSearchCard.vue rename to client/components/cards/ItemSearchCard.vue index 1a6378f7..83d22f17 100644 --- a/client/components/cards/AudiobookSearchCard.vue +++ b/client/components/cards/ItemSearchCard.vue @@ -40,6 +40,12 @@ export default { media() { return this.libraryItem ? this.libraryItem.media || {} : {} }, + mediaType() { + return this.libraryItem ? this.libraryItem.mediaType : null + }, + isPodcast() { + return this.mediaType == 'podcast' + }, mediaMetadata() { return this.media.metadata || {} }, @@ -49,11 +55,9 @@ export default { subtitle() { return this.mediaMetadata.subtitle || '' }, - authors() { - return this.mediaMetadata.authors || [] - }, authorName() { - return this.authors.map((au) => au.name).join(', ') + if (this.isPodcast) return this.mediaMetadata.author || 'Unknown' + return this.mediaMetadata.authorName || 'Unknown' }, matchHtml() { if (!this.matchText || !this.search) return '' diff --git a/client/components/controls/GlobalSearch.vue b/client/components/controls/GlobalSearch.vue index 7eeb25bc..8e39f527 100644 --- a/client/components/controls/GlobalSearch.vue +++ b/client/components/controls/GlobalSearch.vue @@ -19,11 +19,20 @@

No Results