mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-01 04:54:54 +02:00
Add podcast episode auto download new episodes cron
This commit is contained in:
parent
d5e96a3422
commit
0dd219f303
10 changed files with 155 additions and 15 deletions
|
@ -82,6 +82,11 @@ class PodcastController {
|
|||
Logger.info(`[PodcastController] Podcast created now starting ${payload.episodesToDownload.length} episode downloads`)
|
||||
this.podcastManager.downloadPodcastEpisodes(libraryItem, payload.episodesToDownload)
|
||||
}
|
||||
|
||||
// Turn on podcast auto download cron if not already on
|
||||
if (libraryItem.media.autoDownloadEpisodes && !this.podcastManager.episodeScheduleTask) {
|
||||
this.podcastManager.schedulePodcastEpisodeCron()
|
||||
}
|
||||
}
|
||||
|
||||
getPodcastFeed(req, res) {
|
||||
|
@ -105,5 +110,21 @@ class PodcastController {
|
|||
res.status(500).send(error)
|
||||
})
|
||||
}
|
||||
|
||||
async checkNewEpisodes(req, res) {
|
||||
var libraryItem = this.db.getLibraryItem(req.params.id)
|
||||
if (!libraryItem || libraryItem.mediaType !== 'podcast') {
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
if (!libraryItem.media.metadata.feedUrl) {
|
||||
Logger.error(`[PodcastController] checkNewEpisodes no feed url for item ${libraryItem.id}`)
|
||||
return res.status(500).send('Podcast has no rss feed url')
|
||||
}
|
||||
|
||||
var newEpisodes = await this.podcastManager.checkPodcastForNewEpisodes(libraryItem)
|
||||
res.json({
|
||||
episodes: newEpisodes || []
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = new PodcastController()
|
Loading…
Add table
Add a link
Reference in a new issue