mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 01:39:24 +02:00
Update OPML api route to load podcasts from db
This commit is contained in:
parent
8d451217a3
commit
ff0d6326d3
4 changed files with 48 additions and 17 deletions
|
@ -1047,8 +1047,28 @@ class LibraryController {
|
|||
res.json(payload)
|
||||
}
|
||||
|
||||
getOPMLFile(req, res) {
|
||||
const opmlText = this.podcastManager.generateOPMLFileText(req.libraryItems)
|
||||
/**
|
||||
* GET: /api/libraries/:id/opml
|
||||
* Get OPML file for a podcast library
|
||||
* @param {import('express').Request} req
|
||||
* @param {import('express').Response} res
|
||||
*/
|
||||
async getOPMLFile(req, res) {
|
||||
const userPermissionPodcastWhere = libraryItemsPodcastFilters.getUserPermissionPodcastWhereQuery(req.user)
|
||||
const podcasts = await Database.podcastModel.findAll({
|
||||
attributes: ['id', 'feedURL', 'title', 'description', 'itunesPageURL', 'language'],
|
||||
where: userPermissionPodcastWhere.podcastWhere,
|
||||
replacements: userPermissionPodcastWhere.replacements,
|
||||
include: {
|
||||
model: Database.libraryItemModel,
|
||||
attributes: ['id', 'libraryId'],
|
||||
where: {
|
||||
libraryId: req.library.id
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const opmlText = this.podcastManager.generateOPMLFileText(podcasts)
|
||||
res.type('application/xml')
|
||||
res.send(opmlText)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue