mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-15 03:45:03 +02:00
Add collapse series, add filter by series include sequence and sort, show number of episodes on podcast card
This commit is contained in:
parent
2a386ca2a9
commit
174dac8fd4
7 changed files with 80 additions and 15 deletions
|
@ -262,4 +262,33 @@ module.exports = {
|
|||
})
|
||||
return totalSize
|
||||
},
|
||||
|
||||
collapseBookSeries(libraryItems) {
|
||||
var seriesObjects = this.getSeriesFromBooks(libraryItems, true)
|
||||
var seriesToUse = {}
|
||||
var libraryItemIdsToHide = []
|
||||
seriesObjects.forEach((series) => {
|
||||
series.firstBook = series.books.find(b => !seriesToUse[b.id]) // Find first book not already used
|
||||
if (series.firstBook) {
|
||||
seriesToUse[series.firstBook.id] = series
|
||||
libraryItemIdsToHide = libraryItemIdsToHide.concat(series.books.filter(b => !seriesToUse[b.id]).map(b => b.id))
|
||||
}
|
||||
})
|
||||
|
||||
return libraryItems.map((li) => {
|
||||
if (li.mediaType != 'book') return
|
||||
var libraryItemJson = li.toJSONMinified()
|
||||
if (libraryItemIdsToHide.includes(li.id)) {
|
||||
return null
|
||||
}
|
||||
if (seriesToUse[li.id]) {
|
||||
libraryItemJson.collapsedSeries = {
|
||||
id: seriesToUse[li.id].id,
|
||||
name: seriesToUse[li.id].name,
|
||||
numBooks: seriesToUse[li.id].books.length
|
||||
}
|
||||
}
|
||||
return libraryItemJson
|
||||
}).filter(li => li)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue