mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-10 01:15:06 +02:00
Change:Series volume numbers to use language sensitive sorting #261
This commit is contained in:
parent
49fcaefd01
commit
ef94a6bb29
4 changed files with 45 additions and 31 deletions
25
server/controllers/FileSystemController.js
Normal file
25
server/controllers/FileSystemController.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
const Logger = require('../Logger')
|
||||
|
||||
class FileSystemController {
|
||||
constructor() { }
|
||||
|
||||
async getPaths(req, res) {
|
||||
var excludedDirs = ['node_modules', 'client', 'server', '.git', 'static', 'build', 'dist', 'metadata', 'config', 'sys', 'proc'].map(dirname => {
|
||||
return Path.sep + dirname
|
||||
})
|
||||
|
||||
// Do not include existing mapped library paths in response
|
||||
this.db.libraries.forEach(lib => {
|
||||
lib.folders.forEach((folder) => {
|
||||
var dir = folder.fullPath
|
||||
if (dir.includes(global.appRoot)) dir = dir.replace(global.appRoot, '')
|
||||
excludedDirs.push(dir)
|
||||
})
|
||||
})
|
||||
|
||||
Logger.debug(`[Server] get file system paths, excluded: ${excludedDirs.join(', ')}`)
|
||||
var dirs = await this.getDirectories(global.appRoot, '/', excludedDirs)
|
||||
res.json(dirs)
|
||||
}
|
||||
}
|
||||
module.exports = new FileSystemController()
|
|
@ -189,12 +189,9 @@ class LibraryController {
|
|||
if (!audiobooks.length) {
|
||||
return res.status(404).send('Series not found')
|
||||
}
|
||||
audiobooks = sort(audiobooks).asc(ab => {
|
||||
if (!isNaN(ab.book.volumeNumber) && ab.book.volumeNumber !== null) return Number(ab.book.volumeNumber)
|
||||
return ab.book.volumeNumber
|
||||
})
|
||||
var sortedBooks = libraryHelpers.sortSeriesBooks(audiobooks, false)
|
||||
res.json({
|
||||
results: audiobooks.map(ab => ab.toJSONExpanded()),
|
||||
results: sortedBooks,
|
||||
total: audiobooks.length
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue