Fix:Library filters when using other language #1166

This commit is contained in:
advplyr 2022-11-27 17:54:40 -06:00
parent 972271a1a9
commit 4541e9ddc3
4 changed files with 89 additions and 22 deletions

View File

@ -41,9 +41,9 @@
<span class="font-normal block truncate py-2">No {{ sublist }}</span> <span class="font-normal block truncate py-2">No {{ sublist }}</span>
</div> </div>
</li> </li>
<li v-else-if="sublist === 'series'" class="text-gray-50 select-none relative px-2 cursor-pointer hover:bg-black-400" role="option" @click="clickedSublistOption($encode('No Series'))"> <li v-else-if="sublist === 'series'" class="text-gray-50 select-none relative px-2 cursor-pointer hover:bg-black-400" role="option" @click="clickedSublistOption($encode('no-series'))">
<div class="flex items-center"> <div class="flex items-center">
<span class="font-normal block truncate py-2 text-xs text-white text-opacity-80">No Series</span> <span class="font-normal block truncate py-2 text-xs text-white text-opacity-80">{{ $strings.MessageNoSeries }}</span>
</div> </div>
</li> </li>
<template v-for="item in sublistItems"> <template v-for="item in sublistItems">
@ -268,7 +268,24 @@ export default {
return this.filterData.languages || [] return this.filterData.languages || []
}, },
progress() { progress() {
return [this.$strings.LabelFinished, this.$strings.LabelInProgress, this.$strings.LabelNotStarted, this.$strings.LabelNotFinished] return [
{
id: 'finished',
name: this.$strings.LabelFinished
},
{
id: 'in-progress',
name: this.$strings.LabelInProgress
},
{
id: 'not-started',
name: this.$strings.LabelNotStarted
},
{
id: 'not-finished',
name: this.$strings.LabelNotFinished
}
]
}, },
tracks() { tracks() {
return [ return [
@ -283,7 +300,56 @@ export default {
] ]
}, },
missing() { missing() {
return ['ASIN', 'ISBN', this.$strings.LabelSubtitle, this.$strings.LabelAuthor, this.$strings.LabelPublishYear, this.$strings.LabelSeries, this.$strings.LabelDescription, this.$strings.LabelGenres, this.$strings.LabelTags, this.$strings.LabelNarrator, this.$strings.LabelPublisher, this.$strings.LabelLanguage] return [
{
id: 'asin',
name: 'ASIN'
},
{
id: 'isbn',
name: 'ISBN'
},
{
id: 'subtitle',
name: this.$strings.LabelSubtitle
},
{
id: 'authors',
name: this.$strings.LabelAuthor
},
{
id: 'publishedYear',
name: this.$strings.LabelPublishYear
},
{
id: 'series',
name: this.$strings.LabelSeries
},
{
id: 'description',
name: this.$strings.LabelDescription
},
{
id: 'genres',
name: this.$strings.LabelGenres
},
{
id: 'tags',
name: this.$strings.LabelTags
},
{
id: 'narrators',
name: this.$strings.LabelNarrator
},
{
id: 'publisher',
name: this.$strings.LabelPublisher
},
{
id: 'language',
name: this.$strings.LabelLanguage
}
]
}, },
sublistItems() { sublistItems() {
return (this[this.sublist] || []).map((item) => { return (this[this.sublist] || []).map((item) => {

View File

@ -477,6 +477,7 @@
"MessageNoPodcastsFound": "No podcasts found", "MessageNoPodcastsFound": "No podcasts found",
"MessageNoResults": "No Results", "MessageNoResults": "No Results",
"MessageNoSearchResultsFor": "No search results for \"{0}\"", "MessageNoSearchResultsFor": "No search results for \"{0}\"",
"MessageNoSeries": "No Series",
"MessageNotYetImplemented": "Not yet implemented", "MessageNotYetImplemented": "Not yet implemented",
"MessageNoUpdateNecessary": "No update necessary", "MessageNoUpdateNecessary": "No update necessary",
"MessageNoUpdatesWereNecessary": "No updates were necessary", "MessageNoUpdatesWereNecessary": "No updates were necessary",

View File

@ -180,7 +180,7 @@ class LibraryController {
// Determining if we are filtering titles by a series, and if so, which series // Determining if we are filtering titles by a series, and if so, which series
filterSeries = (mediaIsBook && payload.filterBy.startsWith('series.')) ? libraryHelpers.decode(payload.filterBy.replace('series.', '')) : null filterSeries = (mediaIsBook && payload.filterBy.startsWith('series.')) ? libraryHelpers.decode(payload.filterBy.replace('series.', '')) : null
if (filterSeries === 'No Series') filterSeries = null if (filterSeries === 'no-series') filterSeries = null
} }
// Step 2 - If selected, collapse library items by the series they belong to. // Step 2 - If selected, collapse library items by the series they belong to.

View File

@ -20,7 +20,7 @@ module.exports = {
if (group === 'genres') filtered = filtered.filter(li => li.media.metadata && li.media.metadata.genres.includes(filter)) if (group === 'genres') filtered = filtered.filter(li => li.media.metadata && li.media.metadata.genres.includes(filter))
else if (group === 'tags') filtered = filtered.filter(li => li.media.tags.includes(filter)) else if (group === 'tags') filtered = filtered.filter(li => li.media.tags.includes(filter))
else if (group === 'series') { else if (group === 'series') {
if (filter === 'No Series') filtered = filtered.filter(li => li.isBook && !li.media.metadata.series.length) if (filter === 'no-series') filtered = filtered.filter(li => li.isBook && !li.media.metadata.series.length)
else { else {
filtered = filtered.filter(li => li.isBook && li.media.metadata.hasSeries(filter)) filtered = filtered.filter(li => li.isBook && li.media.metadata.hasSeries(filter))
} }
@ -30,27 +30,27 @@ module.exports = {
else if (group === 'progress') { else if (group === 'progress') {
filtered = filtered.filter(li => { filtered = filtered.filter(li => {
const itemProgress = user.getMediaProgress(li.id) const itemProgress = user.getMediaProgress(li.id)
if (filter === 'Finished' && (itemProgress && itemProgress.isFinished)) return true if (filter === 'finished' && (itemProgress && itemProgress.isFinished)) return true
if (filter === 'Not Started' && !itemProgress) return true if (filter === 'not-started' && !itemProgress) return true
if (filter === 'Not Finished' && (!itemProgress || !itemProgress.isFinished)) return true if (filter === 'not-finished' && (!itemProgress || !itemProgress.isFinished)) return true
if (filter === 'In Progress' && (itemProgress && itemProgress.inProgress)) return true if (filter === 'in-progress' && (itemProgress && itemProgress.inProgress)) return true
return false return false
}) })
} else if (group == 'missing') { } else if (group == 'missing') {
filtered = filtered.filter(li => { filtered = filtered.filter(li => {
if (li.isBook) { if (li.isBook) {
if (filter === 'ASIN' && li.media.metadata.asin === null) return true if (filter === 'asin' && li.media.metadata.asin === null) return true
if (filter === 'ISBN' && li.media.metadata.isbn === null) return true if (filter === 'isbn' && li.media.metadata.isbn === null) return true
if (filter === 'Subtitle' && li.media.metadata.subtitle === null) return true if (filter === 'subtitle' && li.media.metadata.subtitle === null) return true
if (filter === 'Author' && li.media.metadata.authors.length === 0) return true if (filter === 'authors' && li.media.metadata.authors.length === 0) return true
if (filter === 'Publish Year' && li.media.metadata.publishedYear === null) return true if (filter === 'publishedYear' && li.media.metadata.publishedYear === null) return true
if (filter === 'Series' && li.media.metadata.series.length === 0) return true if (filter === 'series' && li.media.metadata.series.length === 0) return true
if (filter === 'Description' && li.media.metadata.description === null) return true if (filter === 'description' && li.media.metadata.description === null) return true
if (filter === 'Genres' && li.media.metadata.genres.length === 0) return true if (filter === 'genres' && li.media.metadata.genres.length === 0) return true
if (filter === 'Tags' && li.media.tags.length === 0) return true if (filter === 'tags' && li.media.tags.length === 0) return true
if (filter === 'Narrator' && li.media.metadata.narrators.length === 0) return true if (filter === 'narrators' && li.media.metadata.narrators.length === 0) return true
if (filter === 'Publisher' && li.media.metadata.publisher === null) return true if (filter === 'publisher' && li.media.metadata.publisher === null) return true
if (filter === 'Language' && li.media.metadata.language === null) return true if (filter === 'language' && li.media.metadata.language === null) return true
} else { } else {
return false return false
} }