mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-28 11:22:43 +01: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:
1 parent
debf0f495d
commit
f9e6655359
5 files changed
+107
-46
No files matched your search
@@ -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