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') {
25 return author + '@' + host + port;
28 private static createDurationString(duration: number) {
29 const minutes = Math.floor(duration / 60);
30 const seconds = duration % 60;
31 const minutes_padding = minutes >= 10 ? '' : '0';
32 const seconds_padding = seconds >= 10 ? '' : '0';
34 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
50 this.author = hash.author;
51 this.createdDate = new Date(hash.createdDate);
52 this.description = hash.description;
53 this.duration = Video.createDurationString(hash.duration);
55 this.isLocal = hash.isLocal;
56 this.magnetUri = hash.magnetUri;
57 this.name = hash.name;
58 this.podUrl = hash.podUrl;
59 this.tags = hash.tags;
60 this.thumbnailPath = hash.thumbnailPath;
62 this.by = Video.createByString(hash.author, hash.podUrl);
66 return this.isLocal === true && user && this.author === user.username;