diff --git a/client/components/app/StreamContainer.vue b/client/components/app/StreamContainer.vue index b63fa36d..e86f10d2 100644 --- a/client/components/app/StreamContainer.vue +++ b/client/components/app/StreamContainer.vue @@ -10,7 +10,10 @@
person -

{{ author }}

+

+ {{ author }} +

+

Unknown

@@ -83,6 +86,12 @@ export default { author() { return this.book.author || 'Unknown' }, + authorFL() { + return this.book.authorFL + }, + authorsList() { + return this.authorFL ? this.authorFL.split(', ') : [] + }, streamId() { return this.stream ? this.stream.id : null }, diff --git a/client/pages/audiobook/_id/index.vue b/client/pages/audiobook/_id/index.vue index 82714bbd..3bb6005c 100644 --- a/client/pages/audiobook/_id/index.vue +++ b/client/pages/audiobook/_id/index.vue @@ -17,11 +17,10 @@

{{ subtitle }}

- -

- by {{ authorFL }}Unknown +

+ by {{ author }}

+

by Unknown

{{ seriesText }}
@@ -263,6 +262,9 @@ export default { authorFL() { return this.book.authorFL }, + authorsList() { + return this.authorFL ? this.authorFL.split(', ') : [] + }, authorLF() { return this.book.authorLF }, diff --git a/client/store/audiobooks.js b/client/store/audiobooks.js index a7e4c795..7e637d70 100644 --- a/client/store/audiobooks.js +++ b/client/store/audiobooks.js @@ -59,7 +59,7 @@ export const getters = { if (filter === 'No Series') filtered = filtered.filter(ab => ab.book && !ab.book.series) else filtered = filtered.filter(ab => ab.book && ab.book.series === filter) } - else if (group === 'authors') filtered = filtered.filter(ab => ab.book && ab.book.authorFL === filter) + else if (group === 'authors') filtered = filtered.filter(ab => ab.book && ab.book.authorFL && ab.book.authorFL.split(', ').includes(filter)) else if (group === 'narrators') filtered = filtered.filter(ab => ab.book && ab.book.narrator === filter) else if (group === 'progress') { filtered = filtered.filter(ab => { @@ -132,8 +132,13 @@ export const getters = { return seriesArray }, getUniqueAuthors: (state) => { - var _authors = state.audiobooks.filter(ab => !!(ab.book && ab.book.authorFL)).map(ab => ab.book.authorFL) - return [...new Set(_authors)].sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : 1) + var abAuthors = [] + state.audiobooks.forEach((ab) => { + if (ab.book && ab.book.authorFL) { + abAuthors = abAuthors.concat(ab.book.authorFL.split(', ')) + } + }) + return [...new Set(abAuthors)].sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : 1) }, getUniqueNarrators: (state) => { var _narrators = state.audiobooks.filter(ab => !!(ab.book && ab.book.narrator)).map(ab => ab.book.narrator) diff --git a/server/ApiController.js b/server/ApiController.js index 0ee53ad0..acc42fad 100644 --- a/server/ApiController.js +++ b/server/ApiController.js @@ -174,10 +174,14 @@ class ApiController { } bookMatches.push(bookMatchObj) } - if (queryResult.author && !authorMatches[queryResult.author]) { - authorMatches[queryResult.author] = { - author: queryResult.author - } + if (queryResult.authors) { + queryResult.authors.forEach((author) => { + if (!authorMatches[author]) { + authorMatches[author] = { + author: author + } + } + }) } if (queryResult.series) { if (!seriesMatches[queryResult.series]) { diff --git a/server/objects/Book.js b/server/objects/Book.js index c8583905..af28c7b3 100644 --- a/server/objects/Book.js +++ b/server/objects/Book.js @@ -37,6 +37,7 @@ class Book { get _narrator() { return this.narrator || '' } get _author() { return this.authorFL || '' } get _series() { return this.series || '' } + get _authorsList() { return this._author.split(', ') } get shouldSearchForCover() { if (this.authorFL !== this.lastCoverSearchAuthor || this.title !== this.lastCoverSearchTitle || !this.lastCoverSearch) return true @@ -225,15 +226,18 @@ class Book { getQueryMatches(search) { var titleMatch = this._title.toLowerCase().includes(search) var subtitleMatch = this._subtitle.toLowerCase().includes(search) - var authorMatch = this._author.toLowerCase().includes(search) + + var authorsMatched = this._authorsList.filter(auth => auth.toLowerCase().includes(search)) + + // var authorMatch = this._author.toLowerCase().includes(search) var seriesMatch = this._series.toLowerCase().includes(search) - var bookMatchKey = titleMatch ? 'title' : subtitleMatch ? 'subtitle' : authorMatch ? 'authorFL' : seriesMatch ? 'series' : false + var bookMatchKey = titleMatch ? 'title' : subtitleMatch ? 'subtitle' : authorsMatched.length ? 'authorFL' : seriesMatch ? 'series' : false var bookMatchText = bookMatchKey ? this[bookMatchKey] : '' return { book: bookMatchKey, bookMatchText, - author: authorMatch ? this._author : false, + authors: authorsMatched.length ? authorsMatched : false, series: seriesMatch ? this._series : false } }