mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-31 23:20:05 +02:00
Add:Library settings for mark as finished when time remaining or percent complete #837
This commit is contained in:
parent
6ca277a21d
commit
91aea4f754
8 changed files with 99 additions and 18 deletions
|
@ -229,18 +229,18 @@ class MediaProgress extends Model {
|
|||
const timeRemaining = this.duration - this.currentTime
|
||||
|
||||
// Check if progress is far enough to mark as finished
|
||||
// - If markAsFinishedPercentageComplete is provided, use that otherwise use markAsFinishedTimeRemaining (default 5 seconds)
|
||||
// - If markAsFinishedPercentComplete is provided, use that otherwise use markAsFinishedTimeRemaining (default 10 seconds)
|
||||
let shouldMarkAsFinished = false
|
||||
if (!this.isFinished && this.duration) {
|
||||
if (!isNullOrNaN(progressPayload.markAsFinishedPercentageComplete)) {
|
||||
const markAsFinishedPercentageComplete = Number(progressPayload.markAsFinishedPercentageComplete) / 100
|
||||
shouldMarkAsFinished = markAsFinishedPercentageComplete <= this.progress
|
||||
if (!isNullOrNaN(progressPayload.markAsFinishedPercentComplete)) {
|
||||
const markAsFinishedPercentComplete = Number(progressPayload.markAsFinishedPercentComplete) / 100
|
||||
shouldMarkAsFinished = markAsFinishedPercentComplete < this.progress
|
||||
if (shouldMarkAsFinished) {
|
||||
Logger.debug(`[MediaProgress] Marking media progress as finished because progress (${this.progress}) is greater than ${markAsFinishedPercentageComplete}`)
|
||||
Logger.debug(`[MediaProgress] Marking media progress as finished because progress (${this.progress}) is greater than ${markAsFinishedPercentComplete}`)
|
||||
}
|
||||
} else {
|
||||
const markAsFinishedTimeRemaining = isNullOrNaN(progressPayload.markAsFinishedTimeRemaining) ? 5 : Number(progressPayload.markAsFinishedTimeRemaining)
|
||||
shouldMarkAsFinished = timeRemaining <= markAsFinishedTimeRemaining
|
||||
const markAsFinishedTimeRemaining = isNullOrNaN(progressPayload.markAsFinishedTimeRemaining) ? 10 : Number(progressPayload.markAsFinishedTimeRemaining)
|
||||
shouldMarkAsFinished = timeRemaining < markAsFinishedTimeRemaining
|
||||
if (shouldMarkAsFinished) {
|
||||
Logger.debug(`[MediaProgress] Marking media progress as finished because time remaining (${timeRemaining}) is less than ${markAsFinishedTimeRemaining} seconds`)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue