mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-29 15:19:38 +00:00
Update PlaybackSession to use new library item model
This commit is contained in:
parent
d205c6f734
commit
c251f1899d
16 changed files with 284 additions and 193 deletions
|
|
@ -150,27 +150,5 @@ class Book {
|
|||
this.coverPath = coverPath
|
||||
return true
|
||||
}
|
||||
|
||||
// Only checks container format
|
||||
checkCanDirectPlay(payload) {
|
||||
var supportedMimeTypes = payload.supportedMimeTypes || []
|
||||
return !this.tracks.some((t) => !supportedMimeTypes.includes(t.mimeType))
|
||||
}
|
||||
|
||||
getDirectPlayTracklist() {
|
||||
return this.tracks
|
||||
}
|
||||
|
||||
getPlaybackTitle() {
|
||||
return this.metadata.title
|
||||
}
|
||||
|
||||
getPlaybackAuthor() {
|
||||
return this.metadata.authorName
|
||||
}
|
||||
|
||||
getChapters() {
|
||||
return this.chapters?.map((ch) => ({ ...ch })) || []
|
||||
}
|
||||
}
|
||||
module.exports = Book
|
||||
|
|
|
|||
|
|
@ -199,19 +199,6 @@ class Podcast {
|
|||
return this.episodes.some((ep) => (ep.guid && ep.guid === guid) || ep.checkEqualsEnclosureUrl(url))
|
||||
}
|
||||
|
||||
// Only checks container format
|
||||
checkCanDirectPlay(payload, episodeId) {
|
||||
var episode = this.episodes.find((ep) => ep.id === episodeId)
|
||||
if (!episode) return false
|
||||
return episode.checkCanDirectPlay(payload)
|
||||
}
|
||||
|
||||
getDirectPlayTracklist(episodeId) {
|
||||
var episode = this.episodes.find((ep) => ep.id === episodeId)
|
||||
if (!episode) return false
|
||||
return episode.getDirectPlayTracklist()
|
||||
}
|
||||
|
||||
addPodcastEpisode(podcastEpisode) {
|
||||
this.episodes.push(podcastEpisode)
|
||||
}
|
||||
|
|
@ -224,22 +211,6 @@ class Podcast {
|
|||
return episode
|
||||
}
|
||||
|
||||
getPlaybackTitle(episodeId) {
|
||||
var episode = this.episodes.find((ep) => ep.id == episodeId)
|
||||
if (!episode) return this.metadata.title
|
||||
return episode.title
|
||||
}
|
||||
|
||||
getPlaybackAuthor() {
|
||||
return this.metadata.author
|
||||
}
|
||||
|
||||
getEpisodeDuration(episodeId) {
|
||||
var episode = this.episodes.find((ep) => ep.id == episodeId)
|
||||
if (!episode) return 0
|
||||
return episode.duration
|
||||
}
|
||||
|
||||
getEpisode(episodeId) {
|
||||
if (!episodeId) return null
|
||||
|
||||
|
|
@ -248,9 +219,5 @@ class Podcast {
|
|||
|
||||
return this.episodes.find((ep) => ep.id == episodeId)
|
||||
}
|
||||
|
||||
getChapters(episodeId) {
|
||||
return this.getEpisode(episodeId)?.chapters?.map((ch) => ({ ...ch })) || []
|
||||
}
|
||||
}
|
||||
module.exports = Podcast
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue