audiobookshelf/server/objects/metadata/PodcastMetadata.js

51 lines
1.2 KiB
JavaScript
Raw Normal View History

2022-03-09 02:31:44 +01:00
class PodcastMetadata {
constructor(metadata) {
this.title = null
this.artist = null
this.description = null
this.releaseDate = null
this.genres = []
this.feedUrl = null
this.itunesPageUrl = null
this.itunesId = null
this.itunesArtistId = null
this.explicit = false
2022-03-09 02:31:44 +01:00
if (metadata) {
this.construct(metadata)
}
}
construct(metadata) {
this.title = metadata.title
this.artist = metadata.artist
this.description = metadata.description
this.releaseDate = metadata.releaseDate
this.genres = [...metadata.genres]
this.feedUrl = metadata.feedUrl
this.itunesPageUrl = metadata.itunesPageUrl
this.itunesId = metadata.itunesId
this.itunesArtistId = metadata.itunesArtistId
this.explicit = metadata.explicit
2022-03-09 02:31:44 +01:00
}
toJSON() {
return {
title: this.title,
artist: this.artist,
description: this.description,
releaseDate: this.releaseDate,
genres: [...this.genres],
feedUrl: this.feedUrl,
itunesPageUrl: this.itunesPageUrl,
itunesId: this.itunesId,
itunesArtistId: this.itunesArtistId,
explicit: this.explicit
2022-03-09 02:31:44 +01:00
}
}
toJSONExpanded() {
return this.toJSON()
}
2022-03-09 02:31:44 +01:00
}
module.exports = PodcastMetadata