Made 'expanded' details an explicit parameter

This commit is contained in:
r0adkll 2025-09-08 09:33:35 -04:00
parent 78384e57bf
commit 0fc3b40b8e
No known key found for this signature in database
2 changed files with 10 additions and 9 deletions

View File

@ -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(',')
}

View File

@ -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