mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-11-24 20:05:41 +01:00
Merge 0fc3b40b8e into 0c7b738b7c
This commit is contained in:
commit
f2231a8d30
@ -617,6 +617,7 @@ class LibraryController {
|
||||
filterBy: req.query.filter,
|
||||
mediaType: req.library.mediaType,
|
||||
minified: req.query.minified === '1',
|
||||
expanded: req.query.expanded === '1',
|
||||
collapseseries: req.query.collapseseries === '1',
|
||||
include: include.join(',')
|
||||
}
|
||||
|
||||
@ -293,12 +293,19 @@ class LibraryItem extends Model {
|
||||
*/
|
||||
static async getByFilterAndSort(library, user, options) {
|
||||
let start = Date.now()
|
||||
const { expanded } = options
|
||||
const { libraryItems, count } = await libraryFilters.getFilteredLibraryItems(library.id, user, options)
|
||||
Logger.debug(`Loaded ${libraryItems.length} of ${count} items for libary page in ${((Date.now() - start) / 1000).toFixed(2)}s`)
|
||||
|
||||
return {
|
||||
libraryItems: libraryItems.map((li) => {
|
||||
const oldLibraryItem = li.toOldJSONMinified()
|
||||
let oldLibraryItem = {}
|
||||
if (expanded) {
|
||||
oldLibraryItem = li.toOldJSONExpanded()
|
||||
} else {
|
||||
oldLibraryItem = li.toOldJSONMinified()
|
||||
}
|
||||
|
||||
if (li.collapsedSeries) {
|
||||
oldLibraryItem.collapsedSeries = li.collapsedSeries
|
||||
}
|
||||
@ -306,7 +313,11 @@ class LibraryItem extends Model {
|
||||
oldLibraryItem.media.metadata.series = li.series
|
||||
}
|
||||
if (li.rssFeed) {
|
||||
oldLibraryItem.rssFeed = li.rssFeed.toOldJSONMinified()
|
||||
if (expanded) {
|
||||
oldLibraryItem.rssFeed = li.rssFeed.toOldJSONExpanded()
|
||||
} else {
|
||||
oldLibraryItem.rssFeed = li.rssFeed.toOldJSONMinified()
|
||||
}
|
||||
}
|
||||
if (li.media.numEpisodes) {
|
||||
oldLibraryItem.media.numEpisodes = li.media.numEpisodes
|
||||
|
||||
Loading…
Reference in New Issue
Block a user