mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-02 12:09:11 +01:00
Update:Home page continue series shelf to use first unplayed book (instead of next book after most recently played) #608
This commit is contained in:
parent
313b9026f1
commit
4bcca97b1f
@ -418,7 +418,7 @@ module.exports = {
|
||||
books: [libraryItemJson],
|
||||
inProgress: bookInProgress,
|
||||
bookInProgressLastUpdate: bookInProgress ? mediaProgress.lastUpdate : null,
|
||||
sequenceInProgress: bookInProgress ? libraryItemJson.seriesSequence : null
|
||||
firstBookUnread: bookInProgress ? libraryItemJson : null
|
||||
}
|
||||
seriesMap[librarySeries.id] = series
|
||||
|
||||
@ -445,10 +445,18 @@ module.exports = {
|
||||
|
||||
if (bookInProgress) { // Update if this series is in progress
|
||||
seriesMap[librarySeries.id].inProgress = true
|
||||
if (!seriesMap[librarySeries.id].sequenceInProgress || (librarySeries.sequence && String(librarySeries.sequence).localeCompare(String(seriesMap[librarySeries.id].sequenceInProgress), undefined, { sensitivity: 'base', numeric: true }) > 0)) {
|
||||
seriesMap[librarySeries.id].sequenceInProgress = librarySeries.sequence
|
||||
|
||||
if (seriesMap[librarySeries.id].bookInProgressLastUpdate > mediaProgress.lastUpdate) {
|
||||
seriesMap[librarySeries.id].bookInProgressLastUpdate = mediaProgress.lastUpdate
|
||||
}
|
||||
} else if (!seriesMap[librarySeries.id].firstBookUnread) {
|
||||
seriesMap[librarySeries.id].firstBookUnread = libraryItemJson
|
||||
} else if (libraryItemJson.seriesSequence) {
|
||||
// If current firstBookUnread has a series sequence greater than this series sequence, then update firstBookUnread
|
||||
const firstBookUnreadSequence = seriesMap[librarySeries.id].firstBookUnread.seriesSequence
|
||||
if (!firstBookUnreadSequence || String(firstBookUnreadSequence).localeCompare(String(librarySeries.sequence), undefined, { sensitivity: 'base', numeric: true }) > 0) {
|
||||
seriesMap[librarySeries.id].firstBookUnread = libraryItemJson
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -545,11 +553,8 @@ module.exports = {
|
||||
if (seriesMap[seriesId].inProgress) {
|
||||
seriesMap[seriesId].books = naturalSort(seriesMap[seriesId].books).asc(li => li.seriesSequence)
|
||||
|
||||
const nextBookInSeries = seriesMap[seriesId].books.find(li => {
|
||||
if (!seriesMap[seriesId].sequenceInProgress) return true
|
||||
// True if book series sequence is greater than the current book sequence in progress
|
||||
return String(li.seriesSequence).localeCompare(String(seriesMap[seriesId].sequenceInProgress), undefined, { sensitivity: 'base', numeric: true }) > 0
|
||||
})
|
||||
// NEW implementation takes the first book unread with the smallest series sequence
|
||||
const nextBookInSeries = seriesMap[seriesId].firstBookUnread
|
||||
|
||||
if (nextBookInSeries) {
|
||||
const bookForContinueSeries = {
|
||||
|
Loading…
Reference in New Issue
Block a user