mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-03 20:49:04 +01:00
Merge pull request #465 from selfhost-alt/filter-by-missing-fields
Proposal: Add a filter for media that is missing specific fields
This commit is contained in:
commit
10299e3037
@ -107,6 +107,11 @@ export default {
|
|||||||
value: 'progress',
|
value: 'progress',
|
||||||
sublist: true
|
sublist: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: 'Missing',
|
||||||
|
value: 'missing',
|
||||||
|
sublist: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: 'Issues',
|
text: 'Issues',
|
||||||
value: 'issues',
|
value: 'issues',
|
||||||
@ -206,6 +211,9 @@ export default {
|
|||||||
progress() {
|
progress() {
|
||||||
return ['Finished', 'In Progress', 'Not Started']
|
return ['Finished', 'In Progress', 'Not Started']
|
||||||
},
|
},
|
||||||
|
missing() {
|
||||||
|
return ['ASIN', 'ISBN', 'Subtitle', 'Author', 'Publish Year', 'Series', 'Volume Number', 'Description', 'Genres', 'Tags', 'Narrator', 'Publisher', 'Language', ]
|
||||||
|
},
|
||||||
sublistItems() {
|
sublistItems() {
|
||||||
return (this[this.sublist] || []).map((item) => {
|
return (this[this.sublist] || []).map((item) => {
|
||||||
if (typeof item === 'string') {
|
if (typeof item === 'string') {
|
||||||
|
@ -11,7 +11,7 @@ module.exports = {
|
|||||||
getFilteredLibraryItems(libraryItems, filterBy, user) {
|
getFilteredLibraryItems(libraryItems, filterBy, user) {
|
||||||
var filtered = libraryItems
|
var filtered = libraryItems
|
||||||
|
|
||||||
var searchGroups = ['genres', 'tags', 'series', 'authors', 'progress', 'narrators', 'languages']
|
var searchGroups = ['genres', 'tags', 'series', 'authors', 'progress', 'narrators', 'missing', 'languages']
|
||||||
var group = searchGroups.find(_group => filterBy.startsWith(_group + '.'))
|
var group = searchGroups.find(_group => filterBy.startsWith(_group + '.'))
|
||||||
if (group) {
|
if (group) {
|
||||||
var filterVal = filterBy.replace(`${group}.`, '')
|
var filterVal = filterBy.replace(`${group}.`, '')
|
||||||
@ -34,6 +34,22 @@ module.exports = {
|
|||||||
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') {
|
||||||
|
filtered = filtered.filter(li => {
|
||||||
|
if (filter === 'ASIN' && li.media.metadata.asin === 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 === 'Author' && li.media.metadata.authors.length === 0) return true;
|
||||||
|
if (filter === 'Publish Year' && li.media.metadata.publishedYear === null) return true;
|
||||||
|
if (filter === 'Series' && li.media.metadata.series.length === 0) return true;
|
||||||
|
if (filter === 'Volume Number' && (li.media.metadata.series.length === 0 || li.media.metadata.series[0].sequence === 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 === 'Tags' && li.media.tags.length === 0) return true;
|
||||||
|
if (filter === 'Narrator' && li.media.metadata.narrators.length === 0) return true;
|
||||||
|
if (filter === 'Publisher' && li.media.metadata.publisher === null) return true;
|
||||||
|
if (filter === 'Language' && li.media.metadata.language === null) return true;
|
||||||
|
})
|
||||||
} else if (group === 'languages') {
|
} else if (group === 'languages') {
|
||||||
filtered = filtered.filter(li => li.media.metadata && li.media.metadata.language === filter)
|
filtered = filtered.filter(li => li.media.metadata && li.media.metadata.language === filter)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user