mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-19 11:21:27 +02:00
Update:API endpoint for syncing multiple local sessions. New API endpoint to get current user. Deprecate /me/sync-local-progress endpoint
This commit is contained in:
@@ -141,6 +141,11 @@ class PlaybackSession {
|
||||
this.updatedAt = session.updatedAt || null
|
||||
}
|
||||
|
||||
get mediaItemId() {
|
||||
if (this.episodeId) return `${this.libraryItemId}-${this.episodeId}`
|
||||
return this.libraryItemId
|
||||
}
|
||||
|
||||
get progress() { // Value between 0 and 1
|
||||
if (!this.duration) return 0
|
||||
return Math.max(0, Math.min(this.currentTime / this.duration, 1))
|
||||
@@ -151,6 +156,15 @@ class PlaybackSession {
|
||||
return this.deviceInfo.deviceDescription
|
||||
}
|
||||
|
||||
get mediaProgressObject() {
|
||||
return {
|
||||
duration: this.duration,
|
||||
currentTime: this.currentTime,
|
||||
progress: this.progress,
|
||||
lastUpdate: this.updatedAt
|
||||
}
|
||||
}
|
||||
|
||||
setData(libraryItem, user, mediaPlayer, deviceInfo, startTime, episodeId = null) {
|
||||
this.id = getId('play')
|
||||
this.userId = user.id
|
||||
|
Reference in New Issue
Block a user