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
13 ownerAccount?: Account
15 ownerAvatarUrl?: string
19 viewsPerDay?: ViewsPerDate[]
21 constructor (hash: ServerVideoChannel) {
24 this.displayName = hash.displayName
25 this.description = hash.description
26 this.support = hash.support
27 this.isLocal = hash.isLocal
28 this.nameWithHost = Actor.CREATE_BY_STRING(this.name, this.host)
29 this.nameWithHostForced = Actor.CREATE_BY_STRING(this.name, this.host, true)
31 this.videosCount = hash.videosCount
33 if (hash.viewsPerDay) {
34 this.viewsPerDay = hash.viewsPerDay.map(v => ({ ...v, date: new Date(v.date) }))
37 if (hash.ownerAccount) {
38 this.ownerAccount = hash.ownerAccount
39 this.ownerBy = Actor.CREATE_BY_STRING(hash.ownerAccount.name, hash.ownerAccount.host)
40 this.ownerAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.ownerAccount)