2022-06-08 01:29:43 +02:00
|
|
|
class FeedMeta {
|
|
|
|
constructor(meta) {
|
|
|
|
this.title = null
|
|
|
|
this.description = null
|
|
|
|
this.author = null
|
|
|
|
this.imageUrl = null
|
|
|
|
this.feedUrl = null
|
|
|
|
this.link = null
|
2022-06-08 02:25:14 +02:00
|
|
|
this.explicit = null
|
2022-06-08 01:29:43 +02:00
|
|
|
|
|
|
|
if (meta) {
|
|
|
|
this.construct(meta)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
construct(meta) {
|
|
|
|
this.title = meta.title
|
|
|
|
this.description = meta.description
|
|
|
|
this.author = meta.author
|
|
|
|
this.imageUrl = meta.imageUrl
|
|
|
|
this.feedUrl = meta.feedUrl
|
|
|
|
this.link = meta.link
|
2022-06-08 02:25:14 +02:00
|
|
|
this.explicit = meta.explicit
|
2022-06-08 01:29:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
toJSON() {
|
|
|
|
return {
|
|
|
|
title: this.title,
|
|
|
|
description: this.description,
|
|
|
|
author: this.author,
|
|
|
|
imageUrl: this.imageUrl,
|
|
|
|
feedUrl: this.feedUrl,
|
2022-06-08 02:25:14 +02:00
|
|
|
link: this.link,
|
|
|
|
explicit: this.explicit
|
2022-06-08 01:29:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-08 02:25:14 +02:00
|
|
|
getRSSData() {
|
2022-06-08 01:29:43 +02:00
|
|
|
return {
|
|
|
|
title: this.title,
|
2022-06-08 02:25:14 +02:00
|
|
|
description: this.description || '',
|
|
|
|
generator: 'Audiobookshelf',
|
|
|
|
feed_url: this.feedUrl,
|
|
|
|
site_url: this.link,
|
|
|
|
image_url: this.imageUrl,
|
|
|
|
language: 'en',
|
|
|
|
custom_namespaces: {
|
|
|
|
'itunes': 'http://www.itunes.com/dtds/podcast-1.0.dtd',
|
|
|
|
'psc': 'http://podlove.org/simple-chapters',
|
|
|
|
'podcast': 'https://podcastindex.org/namespace/1.0'
|
|
|
|
},
|
|
|
|
custom_elements: [
|
|
|
|
{ 'author': this.author || 'advplyr' },
|
|
|
|
{ 'itunes:author': this.author || 'advplyr' },
|
|
|
|
{ 'itunes:summary': this.description || '' },
|
|
|
|
{
|
|
|
|
'itunes:image': {
|
|
|
|
_attr: {
|
|
|
|
href: this.imageUrl
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'itunes:owner': [
|
|
|
|
{ 'itunes:name': this.author || '' },
|
|
|
|
{ 'itunes:email': '' }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"itunes:explicit": !!this.explicit
|
|
|
|
}
|
|
|
|
]
|
2022-06-08 01:29:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = FeedMeta
|