mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-13 15:29:38 +00:00
Add playing podcast episodes, episode progress, podcast page, podcast home page shelves
This commit is contained in:
parent
e32d05ea27
commit
0e665e2091
28 changed files with 526 additions and 82 deletions
|
|
@ -143,14 +143,20 @@ class Podcast {
|
|||
return payload || {}
|
||||
}
|
||||
|
||||
checkHasEpisode(episodeId) {
|
||||
return this.episodes.some(ep => ep.id === episodeId)
|
||||
}
|
||||
|
||||
// Only checks container format
|
||||
checkCanDirectPlay(payload, epsiodeIndex = 0) {
|
||||
var episode = this.episodes[epsiodeIndex]
|
||||
checkCanDirectPlay(payload, episodeId) {
|
||||
var episode = this.episodes.find(ep => ep.id === episodeId)
|
||||
if (!episode) return false
|
||||
return episode.checkCanDirectPlay(payload)
|
||||
}
|
||||
|
||||
getDirectPlayTracklist(libraryItemId, episodeIndex = 0) {
|
||||
var episode = this.episodes[episodeIndex]
|
||||
getDirectPlayTracklist(libraryItemId, episodeId) {
|
||||
var episode = this.episodes.find(ep => ep.id === episodeId)
|
||||
if (!episode) return false
|
||||
return episode.getDirectPlayTracklist(libraryItemId)
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +170,15 @@ class Podcast {
|
|||
this.episodes.push(pe)
|
||||
}
|
||||
|
||||
setEpisodeOrder(episodeIds) {
|
||||
this.episodes = this.episodes.map(ep => {
|
||||
var indexOf = episodeIds.findIndex(id => id === ep.id)
|
||||
ep.index = indexOf + 1
|
||||
return ep
|
||||
})
|
||||
this.episodes.sort((a, b) => b.index - a.index)
|
||||
}
|
||||
|
||||
reorderEpisodes() {
|
||||
var hasUpdates = false
|
||||
this.episodes = naturalSort(this.episodes).asc((ep) => ep.bestFilename)
|
||||
|
|
@ -173,7 +188,12 @@ class Podcast {
|
|||
hasUpdates = true
|
||||
}
|
||||
}
|
||||
this.episodes.sort((a, b) => b.index - a.index)
|
||||
return hasUpdates
|
||||
}
|
||||
|
||||
removeEpisode(episodeId) {
|
||||
this.episodes = this.episodes.filter(ep => ep.id !== episodeId)
|
||||
}
|
||||
}
|
||||
module.exports = Podcast
|
||||
Loading…
Add table
Add a link
Reference in a new issue