Add Prev/Next buttons on podcast editing

This commit is contained in:
mfcar 2023-03-04 19:04:55 +00:00
parent 12f231b886
commit 72396c5a98
No known key found for this signature in database
5 changed files with 166 additions and 10 deletions

View file

@ -225,6 +225,20 @@ class PodcastController {
res.json(libraryItem.toJSONExpanded())
}
// GET: api/podcasts/:id/episode/:episodeId
async getEpisode(req, res) {
const episodeId = req.params.episodeId;
const libraryItem = req.libraryItem;
const episode = libraryItem.media.episodes.find(ep => ep.id === episodeId);
if (!episode) {
Logger.error(`[PodcastController] getEpisode episode ${episodeId} not found for item ${libraryItem.id}`)
return res.sendStatus(404)
}
res.json(episode)
}
// DELETE: api/podcasts/:id/episode/:episodeId
async removeEpisode(req, res) {
var episodeId = req.params.episodeId
@ -283,4 +297,4 @@ class PodcastController {
next()
}
}
module.exports = new PodcastController()
module.exports = new PodcastController()

View file

@ -235,6 +235,7 @@ class ApiRouter {
this.router.get('/podcasts/:id/search-episode', PodcastController.middleware.bind(this), PodcastController.findEpisode.bind(this))
this.router.post('/podcasts/:id/download-episodes', PodcastController.middleware.bind(this), PodcastController.downloadEpisodes.bind(this))
this.router.post('/podcasts/:id/match-episodes', PodcastController.middleware.bind(this), PodcastController.quickMatchEpisodes.bind(this))
this.router.get('/podcasts/:id/episode/:episodeId', PodcastController.middleware.bind(this), PodcastController.getEpisode.bind(this))
this.router.patch('/podcasts/:id/episode/:episodeId', PodcastController.middleware.bind(this), PodcastController.updateEpisode.bind(this))
this.router.delete('/podcasts/:id/episode/:episodeId', PodcastController.middleware.bind(this), PodcastController.removeEpisode.bind(this))
@ -553,4 +554,4 @@ class ApiRouter {
}
}
}
module.exports = ApiRouter
module.exports = ApiRouter