mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-22 00:07:52 +01:00
Update item api endpoint to include user media progress with item if using query string include=progress and optionally episode=episodeid - for mobile app downloads
This commit is contained in:
parent
4291769b93
commit
d189ec74c9
@ -11,6 +11,12 @@ class LibraryItemController {
|
||||
if (req.query.expanded == 1) {
|
||||
var item = req.libraryItem.toJSONExpanded()
|
||||
|
||||
// Include users media progress
|
||||
if (includeEntities.includes('progress')) {
|
||||
var episodeId = req.query.episode || null
|
||||
item.userMediaProgress = req.user.getMediaProgress(item.id, episodeId)
|
||||
}
|
||||
|
||||
if (item.mediaType == 'book') {
|
||||
if (includeEntities.includes('authors')) {
|
||||
item.media.metadata.authors = item.media.metadata.authors.map(au => {
|
||||
|
@ -2,7 +2,7 @@ const Logger = require('../../Logger')
|
||||
|
||||
class MediaProgress {
|
||||
constructor(progress) {
|
||||
this.id = null // Same as library item id
|
||||
this.id = null
|
||||
this.libraryItemId = null
|
||||
this.episodeId = null // For podcasts
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user