mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-20 01:17:45 +02:00
Fix:Mark as not finished when duration is not set in media progress #771
This commit is contained in:
parent
59c5e2c1d9
commit
76d668514e
@ -57,6 +57,7 @@ class MeController {
|
|||||||
if (!libraryItem) {
|
if (!libraryItem) {
|
||||||
return res.status(404).send('Item not found')
|
return res.status(404).send('Item not found')
|
||||||
}
|
}
|
||||||
|
|
||||||
var wasUpdated = req.user.createUpdateMediaProgress(libraryItem, req.body)
|
var wasUpdated = req.user.createUpdateMediaProgress(libraryItem, req.body)
|
||||||
if (wasUpdated) {
|
if (wasUpdated) {
|
||||||
await this.db.updateEntity('user', req.user)
|
await this.db.updateEntity('user', req.user)
|
||||||
|
@ -91,7 +91,7 @@ class MediaProgress {
|
|||||||
|
|
||||||
var timeRemaining = this.duration - this.currentTime
|
var timeRemaining = this.duration - this.currentTime
|
||||||
// If time remaining is less than 5 seconds then mark as finished
|
// If time remaining is less than 5 seconds then mark as finished
|
||||||
if ((this.progress >= 1 || (!isNaN(timeRemaining) && timeRemaining < 5))) {
|
if ((this.progress >= 1 || (this.duration && !isNaN(timeRemaining) && timeRemaining < 5))) {
|
||||||
this.isFinished = true
|
this.isFinished = true
|
||||||
this.finishedAt = Date.now()
|
this.finishedAt = Date.now()
|
||||||
this.progress = 1
|
this.progress = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user