diff --git a/client/components/controls/EpisodeSortSelect.vue b/client/components/controls/EpisodeSortSelect.vue index 27aced3f..7819e4a3 100644 --- a/client/components/controls/EpisodeSortSelect.vue +++ b/client/components/controls/EpisodeSortSelect.vue @@ -33,8 +33,8 @@ export default { showMenu: false, items: [ { - text: 'Current', - value: 'index' + text: 'Pub Date', + value: 'publishedAt' }, { text: 'Title', @@ -47,10 +47,6 @@ export default { { text: 'Episode', value: 'episode' - }, - { - text: 'Pub Date', - value: 'publishedAt' } ] } diff --git a/client/components/modals/authors/EditModal.vue b/client/components/modals/authors/EditModal.vue index ef3eb03e..3657bc85 100644 --- a/client/components/modals/authors/EditModal.vue +++ b/client/components/modals/authors/EditModal.vue @@ -6,7 +6,7 @@
-
+
diff --git a/client/components/tables/podcast/EpisodeTableRow.vue b/client/components/tables/podcast/EpisodeTableRow.vue index bcb64ecc..b4adeb49 100644 --- a/client/components/tables/podcast/EpisodeTableRow.vue +++ b/client/components/tables/podcast/EpisodeTableRow.vue @@ -1,11 +1,6 @@ diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index 6765e5f1..b920de46 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -224,20 +224,6 @@ class LibraryItemController { res.json(libraryItem.toJSON()) } - // PATCH: api/items/:id/episodes - async updateEpisodes(req, res) { // For updating podcast episode order - var libraryItem = req.libraryItem - var orderedFileData = req.body.episodes - if (!libraryItem.media.setEpisodeOrder) { - Logger.error(`[LibraryItemController] updateEpisodes invalid media type ${libraryItem.id}`) - return res.sendStatus(500) - } - libraryItem.media.setEpisodeOrder(orderedFileData) - await this.db.updateLibraryItem(libraryItem) - this.emitter('item_updated', libraryItem.toJSONExpanded()) - res.json(libraryItem.toJSON()) - } - // DELETE: api/items/:id/episode/:episodeId async removeEpisode(req, res) { var episodeId = req.params.episodeId diff --git a/server/objects/mediaTypes/Podcast.js b/server/objects/mediaTypes/Podcast.js index 55ae0c15..a6e38c51 100644 --- a/server/objects/mediaTypes/Podcast.js +++ b/server/objects/mediaTypes/Podcast.js @@ -224,18 +224,10 @@ class Podcast { this.episodes.push(pe) } - setEpisodeOrder(episodeIds) { - episodeIds.reverse() // episode Ids will already be in descending order - 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 + + // TODO: Sort by published date this.episodes = naturalSort(this.episodes).asc((ep) => ep.bestFilename) for (let i = 0; i < this.episodes.length; i++) { if (this.episodes[i].index !== (i + 1)) { diff --git a/server/routers/ApiRouter.js b/server/routers/ApiRouter.js index d2b67114..8af4d9f6 100644 --- a/server/routers/ApiRouter.js +++ b/server/routers/ApiRouter.js @@ -90,7 +90,6 @@ class ApiRouter { this.router.post('/items/:id/play', LibraryItemController.middleware.bind(this), LibraryItemController.startPlaybackSession.bind(this)) this.router.post('/items/:id/play/:episodeId', LibraryItemController.middleware.bind(this), LibraryItemController.startEpisodePlaybackSession.bind(this)) this.router.patch('/items/:id/tracks', LibraryItemController.middleware.bind(this), LibraryItemController.updateTracks.bind(this)) - this.router.patch('/items/:id/episodes', LibraryItemController.middleware.bind(this), LibraryItemController.updateEpisodes.bind(this)) this.router.delete('/items/:id/episode/:episodeId', LibraryItemController.middleware.bind(this), LibraryItemController.removeEpisode.bind(this)) this.router.get('/items/:id/scan', LibraryItemController.middleware.bind(this), LibraryItemController.scan.bind(this)) this.router.get('/items/:id/audio-metadata', LibraryItemController.middleware.bind(this), LibraryItemController.updateAudioFileMetadata.bind(this))