mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-09 21:39:37 +00:00
Remove old Feed/FeedEpisode/FeedMeta objects
This commit is contained in:
parent
de8a9304d2
commit
b39268ccb0
17 changed files with 84 additions and 326 deletions
|
|
@ -1,77 +0,0 @@
|
|||
const FeedMeta = require('./FeedMeta')
|
||||
const FeedEpisode = require('./FeedEpisode')
|
||||
|
||||
class Feed {
|
||||
constructor(feed) {
|
||||
this.id = null
|
||||
this.slug = null
|
||||
this.userId = null
|
||||
this.entityType = null
|
||||
this.entityId = null
|
||||
this.entityUpdatedAt = null
|
||||
|
||||
this.coverPath = null
|
||||
this.serverAddress = null
|
||||
this.feedUrl = null
|
||||
|
||||
this.meta = null
|
||||
this.episodes = null
|
||||
|
||||
this.createdAt = null
|
||||
this.updatedAt = null
|
||||
|
||||
if (feed) {
|
||||
this.construct(feed)
|
||||
}
|
||||
}
|
||||
|
||||
construct(feed) {
|
||||
this.id = feed.id
|
||||
this.slug = feed.slug
|
||||
this.userId = feed.userId
|
||||
this.entityType = feed.entityType
|
||||
this.entityId = feed.entityId
|
||||
this.entityUpdatedAt = feed.entityUpdatedAt
|
||||
this.coverPath = feed.coverPath
|
||||
this.serverAddress = feed.serverAddress
|
||||
this.feedUrl = feed.feedUrl
|
||||
this.meta = new FeedMeta(feed.meta)
|
||||
this.episodes = feed.episodes.map((ep) => new FeedEpisode(ep))
|
||||
this.createdAt = feed.createdAt
|
||||
this.updatedAt = feed.updatedAt
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
slug: this.slug,
|
||||
userId: this.userId,
|
||||
entityType: this.entityType,
|
||||
entityId: this.entityId,
|
||||
coverPath: this.coverPath,
|
||||
serverAddress: this.serverAddress,
|
||||
feedUrl: this.feedUrl,
|
||||
meta: this.meta.toJSON(),
|
||||
episodes: this.episodes.map((ep) => ep.toJSON()),
|
||||
createdAt: this.createdAt,
|
||||
updatedAt: this.updatedAt
|
||||
}
|
||||
}
|
||||
|
||||
toJSONMinified() {
|
||||
return {
|
||||
id: this.id,
|
||||
entityType: this.entityType,
|
||||
entityId: this.entityId,
|
||||
feedUrl: this.feedUrl,
|
||||
meta: this.meta.toJSONMinified()
|
||||
}
|
||||
}
|
||||
|
||||
getEpisodePath(id) {
|
||||
var episode = this.episodes.find((ep) => ep.id === id)
|
||||
if (!episode) return null
|
||||
return episode.fullPath
|
||||
}
|
||||
}
|
||||
module.exports = Feed
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
class FeedEpisode {
|
||||
constructor(episode) {
|
||||
this.id = null
|
||||
|
||||
this.title = null
|
||||
this.description = null
|
||||
this.enclosure = null
|
||||
this.pubDate = null
|
||||
this.link = null
|
||||
this.author = null
|
||||
this.explicit = null
|
||||
this.duration = null
|
||||
this.season = null
|
||||
this.episode = null
|
||||
this.episodeType = null
|
||||
|
||||
this.libraryItemId = null
|
||||
this.episodeId = null
|
||||
this.trackIndex = null
|
||||
this.fullPath = null
|
||||
|
||||
if (episode) {
|
||||
this.construct(episode)
|
||||
}
|
||||
}
|
||||
|
||||
construct(episode) {
|
||||
this.id = episode.id
|
||||
this.title = episode.title
|
||||
this.description = episode.description
|
||||
this.enclosure = episode.enclosure ? { ...episode.enclosure } : null
|
||||
this.pubDate = episode.pubDate
|
||||
this.link = episode.link
|
||||
this.author = episode.author
|
||||
this.explicit = episode.explicit
|
||||
this.duration = episode.duration
|
||||
this.season = episode.season
|
||||
this.episode = episode.episode
|
||||
this.episodeType = episode.episodeType
|
||||
this.libraryItemId = episode.libraryItemId
|
||||
this.episodeId = episode.episodeId || null
|
||||
this.trackIndex = episode.trackIndex || 0
|
||||
this.fullPath = episode.fullPath
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
title: this.title,
|
||||
description: this.description,
|
||||
enclosure: this.enclosure ? { ...this.enclosure } : null,
|
||||
pubDate: this.pubDate,
|
||||
link: this.link,
|
||||
author: this.author,
|
||||
explicit: this.explicit,
|
||||
duration: this.duration,
|
||||
season: this.season,
|
||||
episode: this.episode,
|
||||
episodeType: this.episodeType,
|
||||
libraryItemId: this.libraryItemId,
|
||||
episodeId: this.episodeId,
|
||||
trackIndex: this.trackIndex,
|
||||
fullPath: this.fullPath
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = FeedEpisode
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
class FeedMeta {
|
||||
constructor(meta) {
|
||||
this.title = null
|
||||
this.description = null
|
||||
this.author = null
|
||||
this.imageUrl = null
|
||||
this.feedUrl = null
|
||||
this.link = null
|
||||
this.explicit = null
|
||||
this.type = null
|
||||
this.language = null
|
||||
this.preventIndexing = null
|
||||
this.ownerName = null
|
||||
this.ownerEmail = null
|
||||
|
||||
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
|
||||
this.explicit = meta.explicit
|
||||
this.type = meta.type
|
||||
this.language = meta.language
|
||||
this.preventIndexing = meta.preventIndexing
|
||||
this.ownerName = meta.ownerName
|
||||
this.ownerEmail = meta.ownerEmail
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
title: this.title,
|
||||
description: this.description,
|
||||
author: this.author,
|
||||
imageUrl: this.imageUrl,
|
||||
feedUrl: this.feedUrl,
|
||||
link: this.link,
|
||||
explicit: this.explicit,
|
||||
type: this.type,
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = FeedMeta
|
||||
Loading…
Add table
Add a link
Reference in a new issue