- constructor (
- video?: Video & {
- tags: string[],
- commentsEnabled: boolean,
- downloadEnabled: boolean,
- support: string,
- thumbnailUrl: string,
- previewUrl: string
- }) {
- if (video) {
- this.id = video.id
- this.uuid = video.uuid
- this.category = video.category.id
- this.licence = video.licence.id
- this.language = video.language.id
- this.description = video.description
- this.name = video.name
- this.tags = video.tags
- this.nsfw = video.nsfw
- this.commentsEnabled = video.commentsEnabled
- this.downloadEnabled = video.downloadEnabled
- this.waitTranscoding = video.waitTranscoding
- this.channelId = video.channel.id
- this.privacy = video.privacy.id
- this.support = video.support
- this.thumbnailUrl = video.thumbnailUrl
- this.previewUrl = video.previewUrl
-
- this.scheduleUpdate = video.scheduledUpdate
- this.originallyPublishedAt = video.originallyPublishedAt ? new Date(video.originallyPublishedAt) : null
-
- this.pluginData = video.pluginData
- }
+ constructor (video?: VideoDetails) {
+ if (!video) return
+
+ this.id = video.id
+ this.uuid = video.uuid
+ this.shortUUID = video.shortUUID
+ this.category = video.category.id
+ this.licence = video.licence.id
+ this.language = video.language.id
+ this.description = video.description
+ this.name = video.name
+ this.tags = video.tags
+ this.nsfw = video.nsfw
+ this.waitTranscoding = video.waitTranscoding
+ this.channelId = video.channel.id
+ this.privacy = video.privacy.id
+
+ this.support = video.support
+
+ this.commentsEnabled = video.commentsEnabled
+ this.downloadEnabled = video.downloadEnabled
+
+ if (video.thumbnailPath) this.thumbnailUrl = getAbsoluteAPIUrl() + video.thumbnailPath
+ if (video.previewPath) this.previewUrl = getAbsoluteAPIUrl() + video.previewPath
+
+ this.scheduleUpdate = video.scheduledUpdate
+ this.originallyPublishedAt = video.originallyPublishedAt
+ ? new Date(video.originallyPublishedAt)
+ : null
+
+ this.pluginData = video.pluginData