mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
Fix:Book scanner update book series sequence if changed
This commit is contained in:
parent
7402e4811d
commit
14f42e15d1
@ -217,7 +217,8 @@ class BookScanner {
|
|||||||
} else if (key === 'series') {
|
} else if (key === 'series') {
|
||||||
// Check for series added
|
// Check for series added
|
||||||
for (const seriesObj of bookMetadata.series) {
|
for (const seriesObj of bookMetadata.series) {
|
||||||
if (!media.series.some(se => se.name === seriesObj.name)) {
|
const existingBookSeries = media.series.find(se => se.name === seriesObj.name)
|
||||||
|
if (!existingBookSeries) {
|
||||||
const existingSeries = Database.libraryFilterData[libraryItemData.libraryId].series.find(se => se.name === seriesObj.name)
|
const existingSeries = Database.libraryFilterData[libraryItemData.libraryId].series.find(se => se.name === seriesObj.name)
|
||||||
if (existingSeries) {
|
if (existingSeries) {
|
||||||
await Database.bookSeriesModel.create({
|
await Database.bookSeriesModel.create({
|
||||||
@ -238,6 +239,11 @@ class BookScanner {
|
|||||||
libraryScan.addLog(LogLevel.DEBUG, `Updating book "${bookMetadata.title}" added new series "${seriesObj.name}"${seriesObj.sequence ? ` with sequence "${seriesObj.sequence}"` : ''}`)
|
libraryScan.addLog(LogLevel.DEBUG, `Updating book "${bookMetadata.title}" added new series "${seriesObj.name}"${seriesObj.sequence ? ` with sequence "${seriesObj.sequence}"` : ''}`)
|
||||||
seriesUpdated = true
|
seriesUpdated = true
|
||||||
}
|
}
|
||||||
|
} else if (seriesObj.sequence && existingBookSeries.bookSeries.sequence !== seriesObj.sequence) {
|
||||||
|
libraryScan.addLog(LogLevel.DEBUG, `Updating book "${bookMetadata.title}" series "${seriesObj.name}" sequence "${existingBookSeries.bookSeries.sequence || ''}" => "${seriesObj.sequence}"`)
|
||||||
|
seriesUpdated = true
|
||||||
|
existingBookSeries.bookSeries.sequence = seriesObj.sequence
|
||||||
|
await existingBookSeries.bookSeries.save()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check for series removed
|
// Check for series removed
|
||||||
|
Loading…
Reference in New Issue
Block a user