]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-main/video/video.model.ts
Add video file size info in admin videos list
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / video / video.model.ts
index f0a4a3f37c031a9a7b33797d31ed2209e1750ec5..b11316471fe0772d3e05edcbfebfdea712c294ca 100644 (file)
@@ -2,6 +2,7 @@ import { AuthUser } from '@app/core'
 import { User } from '@app/core/users/user.model'
 import { durationToString, getAbsoluteAPIUrl, getAbsoluteEmbedUrl } from '@app/helpers'
 import { Actor } from '@app/shared/shared-main/account/actor.model'
+import { buildVideoWatchPath } from '@shared/core-utils'
 import { peertubeTranslate } from '@shared/core-utils/i18n'
 import {
   ActorImage,
@@ -9,9 +10,11 @@ import {
   UserRight,
   Video as VideoServerModel,
   VideoConstant,
+  VideoFile,
   VideoPrivacy,
   VideoScheduleUpdate,
-  VideoState
+  VideoState,
+  VideoStreamingPlaylist
 } from '@shared/models'
 
 export class Video implements VideoServerModel {
@@ -51,7 +54,7 @@ export class Video implements VideoServerModel {
   embedPath: string
   embedUrl: string
 
-  url?: string
+  url: string
 
   views: number
   likes: number
@@ -64,8 +67,12 @@ export class Video implements VideoServerModel {
   waitTranscoding?: boolean
   state?: VideoConstant<VideoState>
   scheduledUpdate?: VideoScheduleUpdate
+
   blacklisted?: boolean
-  blockedReason?: string
+  blacklistedReason?: string
+
+  blockedOwner?: boolean
+  blockedServer?: boolean
 
   account: {
     id: number
@@ -91,15 +98,18 @@ export class Video implements VideoServerModel {
 
   pluginData?: any
 
+  streamingPlaylists?: VideoStreamingPlaylist[]
+  files?: VideoFile[]
+
   static buildWatchUrl (video: Partial<Pick<Video, 'uuid' | 'shortUUID'>>) {
-    return '/w/' + (video.shortUUID || video.uuid)
+    return buildVideoWatchPath({ shortUUID: video.shortUUID || video.uuid })
   }
 
   static buildUpdateUrl (video: Pick<Video, 'uuid'>) {
     return '/videos/update/' + video.uuid
   }
 
-  constructor (hash: VideoServerModel, translations = {}) {
+  constructor (hash: VideoServerModel, translations: { [ id: string ]: string } = {}) {
     const absoluteAPIUrl = getAbsoluteAPIUrl()
 
     this.createdAt = new Date(hash.createdAt.toString())
@@ -162,7 +172,13 @@ export class Video implements VideoServerModel {
     if (this.state) this.state.label = peertubeTranslate(this.state.label, translations)
 
     this.blacklisted = hash.blacklisted
-    this.blockedReason = hash.blacklistedReason
+    this.blacklistedReason = hash.blacklistedReason
+
+    this.blockedOwner = hash.blockedOwner
+    this.blockedServer = hash.blockedServer
+
+    this.streamingPlaylists = hash.streamingPlaylists
+    this.files = hash.files
 
     this.userHistory = hash.userHistory