mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-21 19:29:37 +00:00
Made 'expanded' details an explicit parameter
This commit is contained in:
parent
78384e57bf
commit
0fc3b40b8e
2 changed files with 10 additions and 9 deletions
|
|
@ -619,6 +619,7 @@ class LibraryController {
|
||||||
filterBy: req.query.filter,
|
filterBy: req.query.filter,
|
||||||
mediaType: req.library.mediaType,
|
mediaType: req.library.mediaType,
|
||||||
minified: req.query.minified === '1',
|
minified: req.query.minified === '1',
|
||||||
|
expanded: req.query.expanded === '1',
|
||||||
collapseseries: req.query.collapseseries === '1',
|
collapseseries: req.query.collapseseries === '1',
|
||||||
include: include.join(',')
|
include: include.join(',')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -293,19 +293,19 @@ class LibraryItem extends Model {
|
||||||
*/
|
*/
|
||||||
static async getByFilterAndSort(library, user, options) {
|
static async getByFilterAndSort(library, user, options) {
|
||||||
let start = Date.now()
|
let start = Date.now()
|
||||||
const { minified } = options
|
const { expanded } = options
|
||||||
const { libraryItems, count } = await libraryFilters.getFilteredLibraryItems(library.id, user, 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`)
|
Logger.debug(`Loaded ${libraryItems.length} of ${count} items for libary page in ${((Date.now() - start) / 1000).toFixed(2)}s`)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
libraryItems: libraryItems.map((li) => {
|
libraryItems: libraryItems.map((li) => {
|
||||||
let oldLibraryItem = {}
|
let oldLibraryItem = {}
|
||||||
if (minified) {
|
if (expanded) {
|
||||||
oldLibraryItem = li.toOldJSONMinified()
|
|
||||||
} else {
|
|
||||||
oldLibraryItem = li.toOldJSONExpanded()
|
oldLibraryItem = li.toOldJSONExpanded()
|
||||||
|
} else {
|
||||||
|
oldLibraryItem = li.toOldJSONMinified()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (li.collapsedSeries) {
|
if (li.collapsedSeries) {
|
||||||
oldLibraryItem.collapsedSeries = li.collapsedSeries
|
oldLibraryItem.collapsedSeries = li.collapsedSeries
|
||||||
}
|
}
|
||||||
|
|
@ -313,10 +313,10 @@ class LibraryItem extends Model {
|
||||||
oldLibraryItem.media.metadata.series = li.series
|
oldLibraryItem.media.metadata.series = li.series
|
||||||
}
|
}
|
||||||
if (li.rssFeed) {
|
if (li.rssFeed) {
|
||||||
if (minified) {
|
if (expanded) {
|
||||||
oldLibraryItem.rssFeed = li.rssFeed.toOldJSONMinified()
|
oldLibraryItem.rssFeed = li.rssFeed.toOldJSONExpanded()
|
||||||
} else {
|
} else {
|
||||||
oldLibraryItem.rssFeed = li.rssFeed.toOldJSON()
|
oldLibraryItem.rssFeed = li.rssFeed.toOldJSONMinified()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (li.media.numEpisodes) {
|
if (li.media.numEpisodes) {
|
||||||
|
|
@ -331,7 +331,7 @@ class LibraryItem extends Model {
|
||||||
if (li.mediaItemShare) {
|
if (li.mediaItemShare) {
|
||||||
oldLibraryItem.mediaItemShare = li.mediaItemShare
|
oldLibraryItem.mediaItemShare = li.mediaItemShare
|
||||||
}
|
}
|
||||||
|
|
||||||
return oldLibraryItem
|
return oldLibraryItem
|
||||||
}),
|
}),
|
||||||
count
|
count
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue