mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-19 04:05:55 -04:00
Fix author order when scanning in multi-author books by setting bookAuthor.createdAt when bulk creating #4177
This commit is contained in:
parent
ca7388b14e
commit
c7faafd0f3
1 changed files with 4 additions and 0 deletions
|
@ -475,6 +475,8 @@ class BookScanner {
|
||||||
bookAuthors: [],
|
bookAuthors: [],
|
||||||
bookSeries: []
|
bookSeries: []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const createdAtTimestamp = new Date().getTime()
|
||||||
if (bookMetadata.authors.length) {
|
if (bookMetadata.authors.length) {
|
||||||
for (const authorName of bookMetadata.authors) {
|
for (const authorName of bookMetadata.authors) {
|
||||||
const matchingAuthorId = await Database.getAuthorIdByName(libraryItemData.libraryId, authorName)
|
const matchingAuthorId = await Database.getAuthorIdByName(libraryItemData.libraryId, authorName)
|
||||||
|
@ -485,6 +487,8 @@ class BookScanner {
|
||||||
} else {
|
} else {
|
||||||
// New author
|
// New author
|
||||||
bookObject.bookAuthors.push({
|
bookObject.bookAuthors.push({
|
||||||
|
// Ensures authors are in a set order
|
||||||
|
createdAt: createdAtTimestamp + bookObject.bookAuthors.length,
|
||||||
author: {
|
author: {
|
||||||
libraryId: libraryItemData.libraryId,
|
libraryId: libraryItemData.libraryId,
|
||||||
name: authorName,
|
name: authorName,
|
||||||
|
|
Loading…
Add table
Reference in a new issue