aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video/video.model.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/video/video.model.ts')
-rw-r--r--client/src/app/shared/video/video.model.ts16
1 files changed, 2 insertions, 14 deletions
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts
index d80c10459..80794faa6 100644
--- a/client/src/app/shared/video/video.model.ts
+++ b/client/src/app/shared/video/video.model.ts
@@ -2,7 +2,7 @@ import { User } from '../'
2import { Video as VideoServerModel, VideoPrivacy, VideoState } 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-constant.model' 4import { VideoConstant } from '../../../../../shared/models/videos/video-constant.model'
5import { getAbsoluteAPIUrl } from '../misc/utils' 5import { durationToString, getAbsoluteAPIUrl } from '../misc/utils'
6import { peertubeTranslate, ServerConfig } from '../../../../../shared/models' 6import { peertubeTranslate, ServerConfig } from '../../../../../shared/models'
7import { Actor } from '@app/shared/actor/actor.model' 7import { Actor } from '@app/shared/actor/actor.model'
8import { VideoScheduleUpdate } from '../../../../../shared/models/videos/video-schedule-update.model' 8import { VideoScheduleUpdate } from '../../../../../shared/models/videos/video-schedule-update.model'
@@ -70,18 +70,6 @@ export class Video implements VideoServerModel {
70 return '/videos/watch/' + videoUUID 70 return '/videos/watch/' + videoUUID
71 } 71 }
72 72
73 private static createDurationString (duration: number) {
74 const hours = Math.floor(duration / 3600)
75 const minutes = Math.floor((duration % 3600) / 60)
76 const seconds = duration % 60
77
78 const minutesPadding = minutes >= 10 ? '' : '0'
79 const secondsPadding = seconds >= 10 ? '' : '0'
80 const displayedHours = hours > 0 ? hours.toString() + ':' : ''
81
82 return displayedHours + minutesPadding + minutes.toString() + ':' + secondsPadding + seconds.toString()
83 }
84
85 constructor (hash: VideoServerModel, translations = {}) { 73 constructor (hash: VideoServerModel, translations = {}) {
86 const absoluteAPIUrl = getAbsoluteAPIUrl() 74 const absoluteAPIUrl = getAbsoluteAPIUrl()
87 75
@@ -95,7 +83,7 @@ export class Video implements VideoServerModel {
95 this.state = hash.state 83 this.state = hash.state
96 this.description = hash.description 84 this.description = hash.description
97 this.duration = hash.duration 85 this.duration = hash.duration
98 this.durationLabel = Video.createDurationString(hash.duration) 86 this.durationLabel = durationToString(hash.duration)
99 this.id = hash.id 87 this.id = hash.id
100 this.uuid = hash.uuid 88 this.uuid = hash.uuid
101 this.isLocal = hash.isLocal 89 this.isLocal = hash.isLocal