mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-11-24 20:05:41 +01:00
Made 'expanded' details an explicit parameter
This commit is contained in:
parent
78384e57bf
commit
0fc3b40b8e
@ -619,6 +619,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,19 +293,19 @@ class LibraryItem extends Model {
|
||||
*/
|
||||
static async getByFilterAndSort(library, user, options) {
|
||||
let start = Date.now()
|
||||
const { minified } = options
|
||||
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) => {
|
||||
let oldLibraryItem = {}
|
||||
if (minified) {
|
||||
oldLibraryItem = li.toOldJSONMinified()
|
||||
} else {
|
||||
if (expanded) {
|
||||
oldLibraryItem = li.toOldJSONExpanded()
|
||||
} else {
|
||||
oldLibraryItem = li.toOldJSONMinified()
|
||||
}
|
||||
|
||||
|
||||
if (li.collapsedSeries) {
|
||||
oldLibraryItem.collapsedSeries = li.collapsedSeries
|
||||
}
|
||||
@ -313,10 +313,10 @@ class LibraryItem extends Model {
|
||||
oldLibraryItem.media.metadata.series = li.series
|
||||
}
|
||||
if (li.rssFeed) {
|
||||
if (minified) {
|
||||
oldLibraryItem.rssFeed = li.rssFeed.toOldJSONMinified()
|
||||
if (expanded) {
|
||||
oldLibraryItem.rssFeed = li.rssFeed.toOldJSONExpanded()
|
||||
} else {
|
||||
oldLibraryItem.rssFeed = li.rssFeed.toOldJSON()
|
||||
oldLibraryItem.rssFeed = li.rssFeed.toOldJSONMinified()
|
||||
}
|
||||
}
|
||||
if (li.media.numEpisodes) {
|
||||
@ -331,7 +331,7 @@ class LibraryItem extends Model {
|
||||
if (li.mediaItemShare) {
|
||||
oldLibraryItem.mediaItemShare = li.mediaItemShare
|
||||
}
|
||||
|
||||
|
||||
return oldLibraryItem
|
||||
}),
|
||||
count
|
||||
|
||||
Loading…
Reference in New Issue
Block a user