mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-01 00:35:07 +02:00
Add:OPML Upload for bulk adding podcasts #588
This commit is contained in:
parent
e5469cc0f8
commit
514893646a
16 changed files with 359 additions and 18 deletions
|
@ -131,7 +131,7 @@ function extractPodcastEpisodes(items) {
|
|||
return episodes
|
||||
}
|
||||
|
||||
function cleanPodcastJson(rssJson) {
|
||||
function cleanPodcastJson(rssJson, excludeEpisodeMetadata) {
|
||||
if (!rssJson.channel || !rssJson.channel.length) {
|
||||
Logger.error(`[podcastUtil] Invalid podcast no channel object`)
|
||||
return null
|
||||
|
@ -142,13 +142,17 @@ function cleanPodcastJson(rssJson) {
|
|||
return null
|
||||
}
|
||||
var podcast = {
|
||||
metadata: extractPodcastMetadata(channel),
|
||||
episodes: extractPodcastEpisodes(channel.item)
|
||||
metadata: extractPodcastMetadata(channel)
|
||||
}
|
||||
if (!excludeEpisodeMetadata) {
|
||||
podcast.episodes = extractPodcastEpisodes(channel.item)
|
||||
} else {
|
||||
podcast.numEpisodes = channel.item.length
|
||||
}
|
||||
return podcast
|
||||
}
|
||||
|
||||
module.exports.parsePodcastRssFeedXml = async (xml, includeRaw = false) => {
|
||||
module.exports.parsePodcastRssFeedXml = async (xml, excludeEpisodeMetadata = false, includeRaw = false) => {
|
||||
if (!xml) return null
|
||||
var json = await xmlToJSON(xml)
|
||||
if (!json || !json.rss) {
|
||||
|
@ -156,7 +160,7 @@ module.exports.parsePodcastRssFeedXml = async (xml, includeRaw = false) => {
|
|||
return null
|
||||
}
|
||||
|
||||
const podcast = cleanPodcastJson(json.rss)
|
||||
const podcast = cleanPodcastJson(json.rss, excludeEpisodeMetadata)
|
||||
if (!podcast) return null
|
||||
|
||||
if (includeRaw) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue