1 import { VideoChannel as ServerVideoChannel, ViewsPerDate, Account } from '@shared/models'
2 import { Actor } from '../account/actor.model'
4 export class VideoChannel extends Actor implements ServerVideoChannel {
10 nameWithHostForced: string
12 ownerAccount?: Account
14 ownerAvatarUrl?: string
18 viewsPerDay?: ViewsPerDate[]
20 constructor (hash: ServerVideoChannel) {
23 this.displayName = hash.displayName
24 this.description = hash.description
25 this.support = hash.support
26 this.isLocal = hash.isLocal
27 this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host)
28 this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true)
30 this.videosCount = hash.videosCount
32 if (hash.viewsPerDay) {
33 this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) }))
36 if (hash.ownerAccount) {
37 this.ownerAccount = hash.ownerAccount
38 this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host)
39 this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount)