mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-06 22:19:04 +01:00
Add chapters to playback session
This commit is contained in:
parent
c201e2aa98
commit
e4936ed522
@ -13,6 +13,7 @@ class PlaybackSession {
|
|||||||
|
|
||||||
this.mediaType = null
|
this.mediaType = null
|
||||||
this.mediaMetadata = null
|
this.mediaMetadata = null
|
||||||
|
this.chapters = null
|
||||||
this.displayTitle = null
|
this.displayTitle = null
|
||||||
this.displayAuthor = null
|
this.displayAuthor = null
|
||||||
this.coverPath = null
|
this.coverPath = null
|
||||||
@ -48,6 +49,7 @@ class PlaybackSession {
|
|||||||
episodeId: this.episodeId,
|
episodeId: this.episodeId,
|
||||||
mediaType: this.mediaType,
|
mediaType: this.mediaType,
|
||||||
mediaMetadata: this.mediaMetadata ? this.mediaMetadata.toJSON() : null,
|
mediaMetadata: this.mediaMetadata ? this.mediaMetadata.toJSON() : null,
|
||||||
|
chapters: (this.chapters || []).map(c => ({ ...c })),
|
||||||
displayTitle: this.displayTitle,
|
displayTitle: this.displayTitle,
|
||||||
displayAuthor: this.displayAuthor,
|
displayAuthor: this.displayAuthor,
|
||||||
coverPath: this.coverPath,
|
coverPath: this.coverPath,
|
||||||
@ -71,6 +73,7 @@ class PlaybackSession {
|
|||||||
episodeId: this.episodeId,
|
episodeId: this.episodeId,
|
||||||
mediaType: this.mediaType,
|
mediaType: this.mediaType,
|
||||||
mediaMetadata: this.mediaMetadata ? this.mediaMetadata.toJSON() : null,
|
mediaMetadata: this.mediaMetadata ? this.mediaMetadata.toJSON() : null,
|
||||||
|
chapters: (this.chapters || []).map(c => ({ ...c })),
|
||||||
displayTitle: this.displayTitle,
|
displayTitle: this.displayTitle,
|
||||||
displayAuthor: this.displayAuthor,
|
displayAuthor: this.displayAuthor,
|
||||||
coverPath: this.coverPath,
|
coverPath: this.coverPath,
|
||||||
@ -98,6 +101,7 @@ class PlaybackSession {
|
|||||||
this.duration = session.duration
|
this.duration = session.duration
|
||||||
this.playMethod = session.playMethod
|
this.playMethod = session.playMethod
|
||||||
this.mediaPlayer = session.mediaPlayer || null
|
this.mediaPlayer = session.mediaPlayer || null
|
||||||
|
this.chapters = session.chapters || []
|
||||||
|
|
||||||
this.mediaMetadata = null
|
this.mediaMetadata = null
|
||||||
if (session.mediaMetadata) {
|
if (session.mediaMetadata) {
|
||||||
@ -130,6 +134,7 @@ class PlaybackSession {
|
|||||||
this.episodeId = episodeId
|
this.episodeId = episodeId
|
||||||
this.mediaType = libraryItem.mediaType
|
this.mediaType = libraryItem.mediaType
|
||||||
this.mediaMetadata = libraryItem.media.metadata.clone()
|
this.mediaMetadata = libraryItem.media.metadata.clone()
|
||||||
|
this.chapters = (libraryItem.media.chapters || []).map(c => ({ ...c })) // Only book mediaType has chapters
|
||||||
this.displayTitle = libraryItem.media.getPlaybackTitle(episodeId)
|
this.displayTitle = libraryItem.media.getPlaybackTitle(episodeId)
|
||||||
this.displayAuthor = libraryItem.media.getPlaybackAuthor(episodeId)
|
this.displayAuthor = libraryItem.media.getPlaybackAuthor(episodeId)
|
||||||
this.coverPath = libraryItem.media.coverPath
|
this.coverPath = libraryItem.media.coverPath
|
||||||
|
Loading…
Reference in New Issue
Block a user