mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-24 04:44:57 +02:00
Add:Api route to sync stream data for use in android native
This commit is contained in:
parent
a052366dac
commit
1b03af4041
4 changed files with 51 additions and 4 deletions
|
@ -179,10 +179,13 @@ class Stream extends EventEmitter {
|
|||
|
||||
syncStream({ timeListened, currentTime }) {
|
||||
var syncLog = ''
|
||||
// Set user current time
|
||||
if (currentTime !== null && !isNaN(currentTime)) {
|
||||
syncLog = `Update client current time ${secondsToTimestamp(currentTime)}`
|
||||
this.clientCurrentTime = currentTime
|
||||
}
|
||||
|
||||
// Update user listening session
|
||||
var saveListeningSession = false
|
||||
if (timeListened && !isNaN(timeListened)) {
|
||||
|
||||
|
@ -202,6 +205,7 @@ class Stream extends EventEmitter {
|
|||
syncLog += `Add listening time ${timeListened}s, Total time listened ${this.listeningSession.timeListening}s`
|
||||
saveListeningSession = true
|
||||
}
|
||||
|
||||
Logger.debug('[Stream]', syncLog)
|
||||
return saveListeningSession ? this.listeningSession : null
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue