13 thumbnailPath: string;
15 private static createByString(author: string, podUrl: string) {
16 let [ host, port ] = podUrl.replace(/^https?:\/\//, '').split(':');
18 if (port === '80' || port === '443') {
24 return author + '@' + host + port;
27 private static createDurationString(duration: number) {
28 const minutes = Math.floor(duration / 60);
29 const seconds = duration % 60;
30 const minutes_padding = minutes >= 10 ? '' : '0';
31 const seconds_padding = seconds >= 10 ? '' : '0';
33 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
49 this.author = hash.author;
50 this.createdDate = new Date(hash.createdDate);
51 this.description = hash.description;
52 this.duration = Video.createDurationString(hash.duration);
54 this.isLocal = hash.isLocal;
55 this.magnetUri = hash.magnetUri;
56 this.name = hash.name;
57 this.podUrl = hash.podUrl;
58 this.tags = hash.tags;
59 this.thumbnailPath = hash.thumbnailPath;
61 this.by = Video.createByString(hash.author, hash.podUrl);
65 return this.isLocal === true && user && this.author === user.username;