mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-13 19:04:57 +02:00
Update:Pass mark as finished library settings to media progress update #837
This commit is contained in:
parent
91aea4f754
commit
0782146682
3 changed files with 38 additions and 10 deletions
|
@ -231,8 +231,8 @@ class MediaProgress extends Model {
|
|||
// Check if progress is far enough to mark as finished
|
||||
// - If markAsFinishedPercentComplete is provided, use that otherwise use markAsFinishedTimeRemaining (default 10 seconds)
|
||||
let shouldMarkAsFinished = false
|
||||
if (!this.isFinished && this.duration) {
|
||||
if (!isNullOrNaN(progressPayload.markAsFinishedPercentComplete)) {
|
||||
if (this.duration) {
|
||||
if (!isNullOrNaN(progressPayload.markAsFinishedPercentComplete) && progressPayload.markAsFinishedPercentComplete > 0) {
|
||||
const markAsFinishedPercentComplete = Number(progressPayload.markAsFinishedPercentComplete) / 100
|
||||
shouldMarkAsFinished = markAsFinishedPercentComplete < this.progress
|
||||
if (shouldMarkAsFinished) {
|
||||
|
@ -247,12 +247,12 @@ class MediaProgress extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
if (shouldMarkAsFinished) {
|
||||
if (!this.isFinished && shouldMarkAsFinished) {
|
||||
this.isFinished = true
|
||||
this.finishedAt = this.finishedAt || Date.now()
|
||||
this.extraData.progress = 1
|
||||
this.changed('extraData', true)
|
||||
} else if (this.isFinished && this.changed('currentTime') && this.currentTime < this.duration) {
|
||||
} else if (this.isFinished && this.changed('currentTime') && !shouldMarkAsFinished) {
|
||||
this.isFinished = false
|
||||
this.finishedAt = null
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue