mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-05-04 01:17:19 +02:00
Fix:Podcast episode sort by published at
This commit is contained in:
parent
3dc848a106
commit
0700f12896
@ -228,6 +228,7 @@ class Podcast {
|
|||||||
|
|
||||||
addPodcastEpisode(podcastEpisode) {
|
addPodcastEpisode(podcastEpisode) {
|
||||||
this.episodes.push(podcastEpisode)
|
this.episodes.push(podcastEpisode)
|
||||||
|
this.reorderEpisodes()
|
||||||
}
|
}
|
||||||
|
|
||||||
addNewEpisodeFromAudioFile(audioFile, index) {
|
addNewEpisodeFromAudioFile(audioFile, index) {
|
||||||
@ -241,15 +242,13 @@ class Podcast {
|
|||||||
reorderEpisodes() {
|
reorderEpisodes() {
|
||||||
var hasUpdates = false
|
var hasUpdates = false
|
||||||
|
|
||||||
// TODO: Sort by published date
|
this.episodes = naturalSort(this.episodes).desc((ep) => ep.publishedAt)
|
||||||
this.episodes = naturalSort(this.episodes).asc((ep) => ep.bestFilename)
|
|
||||||
for (let i = 0; i < this.episodes.length; i++) {
|
for (let i = 0; i < this.episodes.length; i++) {
|
||||||
if (this.episodes[i].index !== (i + 1)) {
|
if (this.episodes[i].index !== (i + 1)) {
|
||||||
this.episodes[i].index = i + 1
|
this.episodes[i].index = i + 1
|
||||||
hasUpdates = true
|
hasUpdates = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.episodes.sort((a, b) => b.index - a.index)
|
|
||||||
return hasUpdates
|
return hasUpdates
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user