mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-10 03:11:34 +00:00
RSS Manager code
This commit is contained in:
parent
2ada293e8a
commit
aefcc4490f
7 changed files with 508 additions and 233 deletions
|
|
@ -127,14 +127,32 @@ class PodcastController {
|
|||
const podcast = await getPodcastFeed(libraryItem.media.metadata.feedUrl)
|
||||
|
||||
if (!podcast) {
|
||||
this.podcastManager.setFeedHealthStatus(libraryItem, false)
|
||||
this.podcastManager.setFeedHealthStatus(libraryItem.media.id, false)
|
||||
return res.status(404).send('Podcast RSS feed request failed or invalid response data')
|
||||
}
|
||||
|
||||
this.podcastManager.setFeedHealthStatus(libraryItem, true)
|
||||
this.podcastManager.setFeedHealthStatus(libraryItem.media.id, true)
|
||||
res.json({ podcast })
|
||||
}
|
||||
|
||||
async checkPodcastFeedUrl(req, res) {
|
||||
const podcastId = req.params.id;
|
||||
|
||||
try {
|
||||
const podcast = await Database.podcastModel.findByPk(req.params.id)
|
||||
|
||||
const podcastResult = await getPodcastFeed(podcast.feedURL);
|
||||
const podcastNewStatus = await this.podcastManager.setFeedHealthStatus(podcastId, !!podcastResult);
|
||||
|
||||
Logger.info(podcastNewStatus);
|
||||
|
||||
return res.json(podcastNewStatus);
|
||||
} catch (error) {
|
||||
Logger.error(`[PodcastController] checkPodcastFeed: Error checking podcast feed for podcast ${podcastId}`, error)
|
||||
res.status(500).json({ error: 'An error occurred while checking the podcast feed.' });
|
||||
}
|
||||
}
|
||||
|
||||
async getFeedsFromOPMLText(req, res) {
|
||||
if (!req.body.opmlText) {
|
||||
return res.sendStatus(400)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue