1 import { VideoChannel as ServerVideoChannel, ViewsPerDate } from '../../../../../shared/models/videos'
2 import { Actor } from '../actor/actor.model'
3 import { Account } from '../../../../../shared/models/actors'
5 export class VideoChannel extends Actor implements ServerVideoChannel {
11 nameWithHostForced: string
12 ownerAccount?: Account
14 ownerAvatarUrl?: string
15 viewsPerDay?: ViewsPerDate[]
17 constructor (hash: ServerVideoChannel) {
20 this.displayName = hash.displayName
21 this.description = hash.description
22 this.support = hash.support
23 this.isLocal = hash.isLocal
24 this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host)
25 this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true)
27 if (hash.viewsPerDay) {
28 this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) }))
31 if (hash.ownerAccount) {
32 this.ownerAccount = hash.ownerAccount
33 this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host)
34 this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount)