Add:Api route to sync stream data for use in android native

This commit is contained in:
advplyr 2021-12-19 18:45:56 -06:00
parent a052366dac
commit 1b03af4041
4 changed files with 51 additions and 4 deletions

View file

@ -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
}