aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video/video.model.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-12 20:04:58 +0200
committerChocobozzz <me@florianbigard.com>2018-06-12 20:37:51 +0200
commit2186386cca113506791583cb07d6ccacba7af4e0 (patch)
tree3c214c0b5fbd64332624267fa6e51fd4a9cf6474 /client/src/app/shared/video/video.model.ts
parent6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf (diff)
downloadPeerTube-2186386cca113506791583cb07d6ccacba7af4e0.tar.gz
PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.tar.zst
PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.zip
Add concept of video state, and add ability to wait transcoding before
publishing a video
Diffstat (limited to 'client/src/app/shared/video/video.model.ts')
-rw-r--r--client/src/app/shared/video/video.model.ts14
1 files changed, 10 insertions, 4 deletions
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 @@
1import { User } from '../' 1import { User } from '../'
2import { Video as VideoServerModel, VideoPrivacy } from '../../../../../shared' 2import { Video as VideoServerModel, VideoPrivacy, VideoState } from '../../../../../shared'
3import { Avatar } from '../../../../../shared/models/avatars/avatar.model' 3import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
4import { VideoConstant } from '../../../../../shared/models/videos/video.model' 4import { VideoConstant } from '../../../../../shared/models/videos/video.model'
5import { getAbsoluteAPIUrl } from '../misc/utils' 5import { getAbsoluteAPIUrl } from '../misc/utils'
@@ -36,6 +36,9 @@ export class Video implements VideoServerModel {
36 dislikes: number 36 dislikes: number
37 nsfw: boolean 37 nsfw: boolean
38 38
39 waitTranscoding?: boolean
40 state?: VideoConstant<VideoState>
41
39 account: { 42 account: {
40 id: number 43 id: number
41 uuid: string 44 uuid: string
@@ -58,15 +61,14 @@ export class Video implements VideoServerModel {
58 61
59 private static createDurationString (duration: number) { 62 private static createDurationString (duration: number) {
60 const hours = Math.floor(duration / 3600) 63 const hours = Math.floor(duration / 3600)
61 const minutes = Math.floor(duration % 3600 / 60) 64 const minutes = Math.floor((duration % 3600) / 60)
62 const seconds = duration % 60 65 const seconds = duration % 60
63 66
64 const minutesPadding = minutes >= 10 ? '' : '0' 67 const minutesPadding = minutes >= 10 ? '' : '0'
65 const secondsPadding = seconds >= 10 ? '' : '0' 68 const secondsPadding = seconds >= 10 ? '' : '0'
66 const displayedHours = hours > 0 ? hours.toString() + ':' : '' 69 const displayedHours = hours > 0 ? hours.toString() + ':' : ''
67 70
68 return displayedHours + minutesPadding + 71 return displayedHours + minutesPadding + minutes.toString() + ':' + secondsPadding + seconds.toString()
69 minutes.toString() + ':' + secondsPadding + seconds.toString()
70 } 72 }
71 73
72 constructor (hash: VideoServerModel, translations = {}) { 74 constructor (hash: VideoServerModel, translations = {}) {
@@ -78,6 +80,8 @@ export class Video implements VideoServerModel {
78 this.licence = hash.licence 80 this.licence = hash.licence
79 this.language = hash.language 81 this.language = hash.language
80 this.privacy = hash.privacy 82 this.privacy = hash.privacy
83 this.waitTranscoding = hash.waitTranscoding
84 this.state = hash.state
81 this.description = hash.description 85 this.description = hash.description
82 this.duration = hash.duration 86 this.duration = hash.duration
83 this.durationLabel = Video.createDurationString(hash.duration) 87 this.durationLabel = Video.createDurationString(hash.duration)
@@ -104,6 +108,8 @@ export class Video implements VideoServerModel {
104 this.licence.label = peertubeTranslate(this.licence.label, translations) 108 this.licence.label = peertubeTranslate(this.licence.label, translations)
105 this.language.label = peertubeTranslate(this.language.label, translations) 109 this.language.label = peertubeTranslate(this.language.label, translations)
106 this.privacy.label = peertubeTranslate(this.privacy.label, translations) 110 this.privacy.label = peertubeTranslate(this.privacy.label, translations)
111
112 if (this.state) this.state.label = peertubeTranslate(this.state.label, translations)
107 } 113 }
108 114
109 isVideoNSFWForUser (user: User, serverConfig: ServerConfig) { 115 isVideoNSFWForUser (user: User, serverConfig: ServerConfig) {