mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Remove test API endpoint for albums
This commit is contained in:
parent
f1130eb63a
commit
09c9c28028
@ -584,32 +584,6 @@ class LibraryController {
|
||||
res.json(payload)
|
||||
}
|
||||
|
||||
// api/libraries/:id/albums
|
||||
async getAlbumsForLibrary(req, res) {
|
||||
if (!req.library.isMusic) {
|
||||
return res.status(400).send('Invalid library media type')
|
||||
}
|
||||
|
||||
let libraryItems = Database.libraryItems.filter(li => li.libraryId === req.library.id)
|
||||
let albums = libraryHelpers.groupMusicLibraryItemsIntoAlbums(libraryItems)
|
||||
albums = naturalSort(albums).asc(a => a.title) // Alphabetical by album title
|
||||
|
||||
const payload = {
|
||||
results: [],
|
||||
total: albums.length,
|
||||
limit: req.query.limit && !isNaN(req.query.limit) ? Number(req.query.limit) : 0,
|
||||
page: req.query.page && !isNaN(req.query.page) ? Number(req.query.page) : 0
|
||||
}
|
||||
|
||||
if (payload.limit) {
|
||||
const startIndex = payload.page * payload.limit
|
||||
albums = albums.slice(startIndex, startIndex + payload.limit)
|
||||
}
|
||||
|
||||
payload.results = albums
|
||||
res.json(payload)
|
||||
}
|
||||
|
||||
async getLibraryFilterData(req, res) {
|
||||
res.json(libraryHelpers.getDistinctFilterDataNew(req.libraryItems))
|
||||
}
|
||||
|
@ -82,7 +82,6 @@ class ApiRouter {
|
||||
this.router.get('/libraries/:id/series/:seriesId', LibraryController.middleware.bind(this), LibraryController.getSeriesForLibrary.bind(this))
|
||||
this.router.get('/libraries/:id/collections', LibraryController.middlewareNew.bind(this), LibraryController.getCollectionsForLibrary.bind(this))
|
||||
this.router.get('/libraries/:id/playlists', LibraryController.middleware.bind(this), LibraryController.getUserPlaylistsForLibrary.bind(this))
|
||||
this.router.get('/libraries/:id/albums', LibraryController.middleware.bind(this), LibraryController.getAlbumsForLibrary.bind(this))
|
||||
this.router.get('/libraries/:id/personalized2', LibraryController.middlewareNew.bind(this), LibraryController.getUserPersonalizedShelves.bind(this))
|
||||
this.router.get('/libraries/:id/personalized', LibraryController.middleware.bind(this), LibraryController.getLibraryUserPersonalizedOptimal.bind(this))
|
||||
this.router.get('/libraries/:id/filterdata', LibraryController.middleware.bind(this), LibraryController.getLibraryFilterData.bind(this))
|
||||
|
Loading…
Reference in New Issue
Block a user