mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-03 01:35:08 +02:00
Add logs to playback session manager
This commit is contained in:
parent
b957e1a36b
commit
3383ec2046
3 changed files with 20 additions and 7 deletions
|
@ -52,6 +52,14 @@ class DeviceInfo {
|
|||
return obj
|
||||
}
|
||||
|
||||
get deviceDescription() {
|
||||
if (this.model) { // Set from mobile apps
|
||||
if (this.sdkVersion) return `${this.model} SDK ${this.sdkVersion} / v${this.clientVersion}`
|
||||
return `${this.model} / v${this.clientVersion}`
|
||||
}
|
||||
return `${this.osName} ${this.osVersion} / ${this.browserName}`
|
||||
}
|
||||
|
||||
setData(ip, ua, clientDeviceInfo, serverVersion) {
|
||||
this.ipAddress = ip || null
|
||||
|
||||
|
@ -62,7 +70,7 @@ class DeviceInfo {
|
|||
this.osVersion = uaObj.os.version || null
|
||||
this.deviceType = uaObj.device.type || null
|
||||
|
||||
var cdi = clientDeviceInfo || {}
|
||||
const cdi = clientDeviceInfo || {}
|
||||
this.clientVersion = cdi.clientVersion || null
|
||||
this.manufacturer = cdi.manufacturer || null
|
||||
this.model = cdi.model || null
|
||||
|
|
|
@ -146,6 +146,11 @@ class PlaybackSession {
|
|||
return Math.max(0, Math.min(this.currentTime / this.duration, 1))
|
||||
}
|
||||
|
||||
get deviceDescription() {
|
||||
if (!this.deviceInfo) return 'No Device Info'
|
||||
return this.deviceInfo.deviceDescription
|
||||
}
|
||||
|
||||
setData(libraryItem, user, mediaPlayer, deviceInfo, startTime, episodeId = null) {
|
||||
this.id = getId('play')
|
||||
this.userId = user.id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue