12 thumbnailPath: string;
14 private static createByString(author: string, podUrl: string) {
15 let [ host, port ] = podUrl.replace(/^https?:\/\//, '').split(':');
17 if (port === '80' || port === '443') {
23 return author + '@' + host + port;
26 private static createDurationString(duration: number) {
27 const minutes = Math.floor(duration / 60);
28 const seconds = duration % 60;
29 const minutes_padding = minutes >= 10 ? '' : '0';
30 const seconds_padding = seconds >= 10 ? '' : '0';
32 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
47 this.author = hash.author;
48 this.createdDate = new Date(hash.createdDate);
49 this.description = hash.description;
50 this.duration = Video.createDurationString(hash.duration);
52 this.isLocal = hash.isLocal;
53 this.magnetUri = hash.magnetUri;
54 this.name = hash.name;
55 this.podUrl = hash.podUrl;
56 this.thumbnailPath = hash.thumbnailPath;
58 this.by = Video.createByString(hash.author, hash.podUrl);
62 return this.isLocal === true && user && this.author === user.username;