13 thumbnailPath: string;
16 private static createByString(author: string, podHost: string) {
17 return author + '@' + podHost;
20 private static createDurationString(duration: number) {
21 const minutes = Math.floor(duration / 60);
22 const seconds = duration % 60;
23 const minutes_padding = minutes >= 10 ? '' : '0';
24 const seconds_padding = seconds >= 10 ? '' : '0';
26 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
40 thumbnailPath: string,
43 this.author = hash.author;
44 this.createdAt = new Date(hash.createdAt);
45 this.description = hash.description;
46 this.duration = Video.createDurationString(hash.duration);
48 this.isLocal = hash.isLocal;
49 this.magnetUri = hash.magnetUri;
50 this.name = hash.name;
51 this.podHost = hash.podHost;
52 this.tags = hash.tags;
53 this.thumbnailPath = hash.thumbnailPath;
54 this.views = hash.views;
56 this.by = Video.createByString(hash.author, hash.podHost);
60 return this.isLocal === true && user && this.author === user.username;