mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Update:Add chapters to playback session so they can be used for podcast episodes in mobile apps
This commit is contained in:
parent
92bb2fb23d
commit
f4f5f79af7
@ -177,7 +177,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.chapters = libraryItem.media.getChapters(episodeId)
|
||||||
this.displayTitle = libraryItem.media.getPlaybackTitle(episodeId)
|
this.displayTitle = libraryItem.media.getPlaybackTitle(episodeId)
|
||||||
this.displayAuthor = libraryItem.media.getPlaybackAuthor()
|
this.displayAuthor = libraryItem.media.getPlaybackAuthor()
|
||||||
this.coverPath = libraryItem.media.coverPath
|
this.coverPath = libraryItem.media.coverPath
|
||||||
|
@ -528,5 +528,9 @@ class Book {
|
|||||||
getPlaybackAuthor() {
|
getPlaybackAuthor() {
|
||||||
return this.metadata.authorName
|
return this.metadata.authorName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getChapters() {
|
||||||
|
return this.chapters?.map(ch => ({ ...ch })) || []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = Book
|
module.exports = Book
|
||||||
|
@ -339,5 +339,9 @@ class Podcast {
|
|||||||
if (!audioFile?.metaTags) return false
|
if (!audioFile?.metaTags) return false
|
||||||
return this.metadata.setDataFromAudioMetaTags(audioFile.metaTags, overrideExistingDetails)
|
return this.metadata.setDataFromAudioMetaTags(audioFile.metaTags, overrideExistingDetails)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getChapters(episodeId) {
|
||||||
|
return this.getEpisode(episodeId)?.chapters?.map(ch => ({ ...ch })) || []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = Podcast
|
module.exports = Podcast
|
||||||
|
Loading…
Reference in New Issue
Block a user