From 2186386cca113506791583cb07d6ccacba7af4e0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 12 Jun 2018 20:04:58 +0200 Subject: Add concept of video state, and add ability to wait transcoding before publishing a video --- client/src/app/shared/video/video.model.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'client/src/app/shared/video/video.model.ts') diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts index d37dc2c3e..48a4b4260 100644 --- a/client/src/app/shared/video/video.model.ts +++ b/client/src/app/shared/video/video.model.ts @@ -1,5 +1,5 @@ import { User } from '../' -import { Video as VideoServerModel, VideoPrivacy } from '../../../../../shared' +import { Video as VideoServerModel, VideoPrivacy, VideoState } from '../../../../../shared' import { Avatar } from '../../../../../shared/models/avatars/avatar.model' import { VideoConstant } from '../../../../../shared/models/videos/video.model' import { getAbsoluteAPIUrl } from '../misc/utils' @@ -36,6 +36,9 @@ export class Video implements VideoServerModel { dislikes: number nsfw: boolean + waitTranscoding?: boolean + state?: VideoConstant + account: { id: number uuid: string @@ -58,15 +61,14 @@ export class Video implements VideoServerModel { private static createDurationString (duration: number) { const hours = Math.floor(duration / 3600) - const minutes = Math.floor(duration % 3600 / 60) + const minutes = Math.floor((duration % 3600) / 60) const seconds = duration % 60 const minutesPadding = minutes >= 10 ? '' : '0' const secondsPadding = seconds >= 10 ? '' : '0' const displayedHours = hours > 0 ? hours.toString() + ':' : '' - return displayedHours + minutesPadding + - minutes.toString() + ':' + secondsPadding + seconds.toString() + return displayedHours + minutesPadding + minutes.toString() + ':' + secondsPadding + seconds.toString() } constructor (hash: VideoServerModel, translations = {}) { @@ -78,6 +80,8 @@ export class Video implements VideoServerModel { this.licence = hash.licence this.language = hash.language this.privacy = hash.privacy + this.waitTranscoding = hash.waitTranscoding + this.state = hash.state this.description = hash.description this.duration = hash.duration this.durationLabel = Video.createDurationString(hash.duration) @@ -104,6 +108,8 @@ export class Video implements VideoServerModel { this.licence.label = peertubeTranslate(this.licence.label, translations) this.language.label = peertubeTranslate(this.language.label, translations) this.privacy.label = peertubeTranslate(this.privacy.label, translations) + + if (this.state) this.state.label = peertubeTranslate(this.state.label, translations) } isVideoNSFWForUser (user: User, serverConfig: ServerConfig) { -- cgit v1.2.3