mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-05 18:54:39 +02:00
Add: Support multiple narrator parse and filter #182
This commit is contained in:
parent
bf2b534170
commit
979fb70c31
4 changed files with 53 additions and 5 deletions
|
@ -30,7 +30,11 @@
|
|||
<span class="text-white text-opacity-60 uppercase text-sm">Narrated By</span>
|
||||
</div>
|
||||
<div>
|
||||
<nuxt-link :to="`/library/${libraryId}/bookshelf?filter=narrators.${$encode(narrator)}`" class="hover:underline">{{ narrator }}</nuxt-link>
|
||||
<template v-for="(narrator, index) in narrators">
|
||||
<nuxt-link :key="narrator" :to="`/library/${libraryId}/bookshelf?filter=narrators.${$encode(narrator)}`" class="hover:underline">{{ narrator }}</nuxt-link
|
||||
><span :key="index" v-if="index < narrators.length - 1">, </span>
|
||||
</template>
|
||||
<!-- <nuxt-link :to="`/library/${libraryId}/bookshelf?filter=narrators.${$encode(narrator)}`" class="hover:underline">{{ narrator }}</nuxt-link> -->
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="publishYear" class="flex py-0.5">
|
||||
|
@ -278,6 +282,10 @@ export default {
|
|||
authorLF() {
|
||||
return this.book.authorLF
|
||||
},
|
||||
narrators() {
|
||||
if (!this.book.narratorFL) return []
|
||||
return this.book.narratorFL.split(', ') || []
|
||||
},
|
||||
authorTooltipText() {
|
||||
var txt = ['FL: ' + this.authorFL || 'Not Set', 'LF: ' + this.authorLF || 'Not Set']
|
||||
return txt.join('<br>')
|
||||
|
|
|
@ -60,7 +60,7 @@ export const getters = {
|
|||
else filtered = filtered.filter(ab => ab.book && ab.book.series === 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 === 'narrators') filtered = filtered.filter(ab => ab.book && ab.book.narratorFL && ab.book.narratorFL.split(', ').includes(filter))
|
||||
else if (group === 'progress') {
|
||||
filtered = filtered.filter(ab => {
|
||||
var userAudiobook = rootGetters['user/getUserAudiobook'](ab.id)
|
||||
|
@ -141,8 +141,13 @@ export const getters = {
|
|||
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)
|
||||
return [...new Set(_narrators)].sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : 1)
|
||||
var narrators = []
|
||||
state.audiobooks.forEach((ab) => {
|
||||
if (ab.book && ab.book.narratorFL) {
|
||||
narrators = narrators.concat(ab.book.narratorFL.split(', '))
|
||||
}
|
||||
})
|
||||
return [...new Set(narrators)].sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : 1)
|
||||
},
|
||||
getGenresUsed: (state) => {
|
||||
var _genres = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue