aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/angular/videos/video.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/angular/videos/video.ts')
-rw-r--r--client/angular/videos/video.ts39
1 files changed, 21 insertions, 18 deletions
diff --git a/client/angular/videos/video.ts b/client/angular/videos/video.ts
index 32ff64eb3..eec537c9e 100644
--- a/client/angular/videos/video.ts
+++ b/client/angular/videos/video.ts
@@ -11,6 +11,27 @@ export class Video {
11 by: string; 11 by: string;
12 duration: string; 12 duration: string;
13 13
14 private static createDurationString(duration: number): string {
15 const minutes = Math.floor(duration / 60);
16 const seconds = duration % 60;
17 const minutes_padding = minutes >= 10 ? '' : '0';
18 const seconds_padding = seconds >= 10 ? '' : '0';
19
20 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
21 }
22
23 private static createByString(author: string, podUrl: string): string {
24 let [ host, port ] = podUrl.replace(/^https?:\/\//, '').split(':');
25
26 if (port === '80' || port === '443') {
27 port = '';
28 } else {
29 port = ':' + port;
30 }
31
32 return author + '@' + host + port;
33 }
34
14 constructor(hash: { 35 constructor(hash: {
15 id: string, 36 id: string,
16 name: string, 37 name: string,
@@ -39,22 +60,4 @@ export class Video {
39 isRemovableBy(user): boolean { 60 isRemovableBy(user): boolean {
40 return this.isLocal === true && user && this.author === user.username; 61 return this.isLocal === true && user && this.author === user.username;
41 } 62 }
42
43 private static createDurationString(duration: number): string {
44 const minutes = Math.floor(duration / 60);
45 const seconds = duration % 60;
46 const minutes_padding = minutes >= 10 ? '' : '0';
47 const seconds_padding = seconds >= 10 ? '' : '0'
48
49 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
50 }
51
52 private static createByString(author: string, podUrl: string): string {
53 let [ host, port ] = podUrl.replace(/^https?:\/\//, '').split(':');
54
55 if (port === '80' || port === '443') port = '';
56 else port = ':' + port;
57
58 return author + '@' + host + port;
59 }
60} 63}