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
- Books
+ Books
-
+
+
+
+
+
+ Podcasts
+
+
+
+
@@ -70,6 +79,7 @@ export default {
isTyping: false,
isFetching: false,
search: null,
+ podcastResults: [],
bookResults: [],
authorResults: [],
seriesResults: [],
@@ -83,7 +93,7 @@ export default {
return this.$store.state.libraries.currentLibraryId
},
totalResults() {
- return this.bookResults.length + this.seriesResults.length + this.authorResults.length + this.tagResults.length
+ return this.bookResults.length + this.seriesResults.length + this.authorResults.length + this.tagResults.length + this.podcastResults.length
}
},
methods: {
@@ -96,6 +106,7 @@ export default {
clearResults() {
this.search = null
this.lastSearch = null
+ this.podcastResults = []
this.bookResults = []
this.authorResults = []
this.seriesResults = []
@@ -136,6 +147,7 @@ export default {
// Search was canceled
if (!this.isFetching) return
+ this.podcastResults = searchResults.podcast || []
this.bookResults = searchResults.book || []
this.authorResults = searchResults.authors || []
this.seriesResults = searchResults.series || []
diff --git a/client/components/ui/MultiSelectQueryInput.vue b/client/components/ui/MultiSelectQueryInput.vue
index 1a448ade..fbf2f1e7 100644
--- a/client/components/ui/MultiSelectQueryInput.vue
+++ b/client/components/ui/MultiSelectQueryInput.vue
@@ -117,7 +117,6 @@ export default {
console.error('Failed to get search results', error)
return []
})
- console.log('Search results', results)
this.items = results || []
this.searching = false
},
diff --git a/client/components/ui/QueryInput.vue b/client/components/ui/QueryInput.vue
index 6eb6275a..27191a92 100644
--- a/client/components/ui/QueryInput.vue
+++ b/client/components/ui/QueryInput.vue
@@ -78,7 +78,6 @@ export default {
console.error('Failed to get search results', error)
return []
})
- // console.log('Search results', results)
this.items = results || []
this.searching = false
},
diff --git a/client/pages/library/_library/search.vue b/client/pages/library/_library/search.vue
index dd3b3153..5ecf1031 100644
--- a/client/pages/library/_library/search.vue
+++ b/client/pages/library/_library/search.vue
@@ -30,7 +30,8 @@ export default {
return null
})
results = {
- books: results && results.book.length ? results.book : null,
+ podcasts: results && results.podcast ? results.podcast : null,
+ books: results && results.book ? results.book : null,
authors: results && results.authors.length ? results.authors : null,
series: results && results.series.length ? results.series : null,
tags: results && results.tags.length ? results.tags : null
@@ -57,7 +58,7 @@ export default {
return this.$store.state.streamLibraryItem
},
hasResults() {
- return Object.values(this.results).find((r) => !!r)
+ return Object.values(this.results).find((r) => !!r && r.length)
}
},
methods: {
@@ -67,7 +68,8 @@ export default {
return null
})
this.results = {
- books: results && results.book.length ? results.book : null,
+ podcasts: results && results.podcast ? results.podcast : null,
+ books: results && results.book ? results.book : null,
authors: results && results.authors.length ? results.authors : null,
series: results && results.series.length ? results.series : null,
tags: results && results.tags.length ? results.tags : null
diff --git a/server/controllers/LibraryController.js b/server/controllers/LibraryController.js
index d4c61acc..d55751b5 100644
--- a/server/controllers/LibraryController.js
+++ b/server/controllers/LibraryController.js
@@ -457,7 +457,7 @@ class LibraryController {
var queryResult = li.searchQuery(req.query.q)
if (queryResult.matchKey) {
itemMatches.push({
- libraryItem: li,
+ libraryItem: li.toJSONExpanded(),
matchKey: queryResult.matchKey,
matchText: queryResult.matchText
})