mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-16 04:14:58 +02:00
Add sync local media progress routes for offline mobile playback session support
This commit is contained in:
parent
fc228013d3
commit
2a386ca2a9
7 changed files with 113 additions and 63 deletions
12
server/Db.js
12
server/Db.js
|
@ -13,6 +13,7 @@ const Library = require('./objects/Library')
|
|||
const Author = require('./objects/entities/Author')
|
||||
const Series = require('./objects/entities/Series')
|
||||
const ServerSettings = require('./objects/ServerSettings')
|
||||
const PlaybackSession = require('./objects/PlaybackSession')
|
||||
|
||||
class Db {
|
||||
constructor() {
|
||||
|
@ -188,6 +189,17 @@ class Db {
|
|||
getLibraryItem(id) {
|
||||
return this.libraryItems.find(li => li.id === id)
|
||||
}
|
||||
getPlaybackSession(id) {
|
||||
return this.sessionsDb.select((pb) => pb.id == id).then((results) => {
|
||||
if (results.data.length) {
|
||||
return new PlaybackSession(results.data[0])
|
||||
}
|
||||
return null
|
||||
}).catch((error) => {
|
||||
Logger.error('Failed to get session', error)
|
||||
return null
|
||||
})
|
||||
}
|
||||
|
||||
async updateLibraryItem(libraryItem) {
|
||||
return this.updateLibraryItems([libraryItem])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue