2024-02-25 18:32:04 +00:00
/ * *
* @ openapi
* components :
* schemas :
* rssFeedMetadata :
* type : object
* properties :
* title :
* description : The title of the entity the RSS feed is for .
* type : string
* example : Welcome to Night Vale
* description :
* description : The description of the entity the RSS feed is for .
* type : [ string , 'null' ]
* example : | 2 -
*
* Twice - monthly community updates for the small desert town of Night Vale , where every conspiracy theory is true . Turn on your radio and hide . Never listened before ? It 's an ongoing radio show. Start with the current episode, and you' ll catch on in no time . Or , go right to Episode 1 if you wanna binge - listen .
* author :
* description : The author of the entity the RSS feed is for .
* type : [ string , 'null' ]
* example : Night Vale Presents
* imageUrl :
* description : The URL of the RSS feed ' s image .
* type : string
* example : https : //abs.example.com/feed/li_bufnnmp4y5o2gbbxfm/cover
* format : url
* feedUrl :
* description : The URL of the RSS feed .
* type : string
* example : https : //abs.example.com/feed/li_bufnnmp4y5o2gbbxfm
* format : url
* link :
* description : The URL of the entity the RSS feed is for .
* type : string
* example : https : //abs.example.com/item/li_bufnnmp4y5o2gbbxfm
* format : url
* explicit :
* description : Whether the RSS feed ' s contents are explicit .
* type : boolean
* example : false
* type :
* description : The type of the RSS feed .
* type : [ string , 'null' ]
* example : episodic
* language :
* description : The language of the RSS feed .
* type : [ string , 'null' ]
* example : en
* preventIndexing :
* description : Whether the RSS feed is marked to prevent indexing of the feed .
* type : boolean
* example : true
* ownerName :
* description : The owner name of the RSS feed .
* type : [ string , 'null' ]
* ownerEmail :
* description : The owner email of the RSS feed .
* type : [ string , 'null' ]
* rssFeedMetadataMinified :
* type : object
* properties :
* title :
* description : The title of the entity the RSS feed is for .
* type : string
* example : Welcome to Night Vale
* description :
* description : The description of the entity the RSS feed is for .
* type : [ string , 'null' ]
* example : | 2 -
*
* Twice - monthly community updates for the small desert town of Night Vale , where every conspiracy theory is true . Turn on your radio and hide . Never listened before ? It 's an ongoing radio show. Start with the current episode, and you' ll catch on in no time . Or , go right to Episode 1 if you wanna binge - listen .
* preventIndexing :
* description : Whether the RSS feed is marked to prevent indexing of the feed .
* type : boolean
* example : true
* ownerName :
* description : The owner name of the RSS feed .
* type : [ string , 'null' ]
* ownerEmail :
* description : The owner email of the RSS feed .
* type : [ string , 'null' ]
* /
2022-06-07 18:29:43 -05: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-07 19:25:14 -05:00
this . explicit = null
2023-02-22 18:22:52 +00:00
this . type = null
2023-02-23 00:33:04 +00:00
this . language = null
2023-02-25 13:20:26 +00:00
this . preventIndexing = null
this . ownerName = null
this . ownerEmail = null
2022-06-07 18:29:43 -05: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-07 19:25:14 -05:00
this . explicit = meta . explicit
2023-02-22 18:22:52 +00:00
this . type = meta . type
2023-02-23 00:33:04 +00:00
this . language = meta . language
2023-02-25 13:20:26 +00:00
this . preventIndexing = meta . preventIndexing
this . ownerName = meta . ownerName
this . ownerEmail = meta . ownerEmail
2022-06-07 18:29:43 -05:00
}
toJSON ( ) {
return {
title : this . title ,
description : this . description ,
author : this . author ,
imageUrl : this . imageUrl ,
feedUrl : this . feedUrl ,
2022-06-07 19:25:14 -05:00
link : this . link ,
2023-02-22 18:22:52 +00:00
explicit : this . explicit ,
2023-02-23 00:33:04 +00:00
type : this . type ,
2023-02-25 13:20:26 +00:00
language : this . language ,
preventIndexing : this . preventIndexing ,
ownerName : this . ownerName ,
ownerEmail : this . ownerEmail
}
}
toJSONMinified ( ) {
return {
title : this . title ,
description : this . description ,
preventIndexing : this . preventIndexing ,
ownerName : this . ownerName ,
ownerEmail : this . ownerEmail
2022-06-07 18:29:43 -05:00
}
}
2022-06-07 19:25:14 -05:00
getRSSData ( ) {
2023-09-08 14:03:12 -05:00
const blockTags = [
{ 'itunes:block' : 'yes' } ,
{ 'googleplay:block' : 'yes' }
]
2022-06-07 18:29:43 -05:00
return {
title : this . title ,
2022-06-07 19:25:14 -05:00
description : this . description || '' ,
generator : 'Audiobookshelf' ,
feed _url : this . feedUrl ,
site _url : this . link ,
image _url : this . imageUrl ,
custom _namespaces : {
'itunes' : 'http://www.itunes.com/dtds/podcast-1.0.dtd' ,
'psc' : 'http://podlove.org/simple-chapters' ,
2023-02-25 13:20:26 +00:00
'podcast' : 'https://podcastindex.org/namespace/1.0' ,
'googleplay' : 'http://www.google.com/schemas/play-podcasts/1.0'
2022-06-07 19:25:14 -05:00
} ,
custom _elements : [
2023-02-23 00:33:04 +00:00
{ 'language' : this . language || 'en' } ,
2022-06-07 19:25:14 -05:00
{ 'author' : this . author || 'advplyr' } ,
{ 'itunes:author' : this . author || 'advplyr' } ,
{ 'itunes:summary' : this . description || '' } ,
2023-02-22 18:22:52 +00:00
{ 'itunes:type' : this . type } ,
2022-06-07 19:25:14 -05:00
{
'itunes:image' : {
_attr : {
href : this . imageUrl
}
}
} ,
{
'itunes:owner' : [
2023-02-25 13:20:26 +00:00
{ 'itunes:name' : this . ownerName || this . author || '' } ,
{ 'itunes:email' : this . ownerEmail || '' }
2022-06-07 19:25:14 -05:00
]
} ,
2023-02-25 13:20:26 +00:00
{ 'itunes:explicit' : ! ! this . explicit } ,
2023-09-08 14:03:12 -05:00
... ( this . preventIndexing ? blockTags : [ ] )
2022-06-07 19:25:14 -05:00
]
2022-06-07 18:29:43 -05:00
}
}
}
2023-02-22 18:22:52 +00:00
module . exports = FeedMeta