13 thumbnailPath: string;
18 private static createByString(author: string, podHost: string) {
19 return author + '@' + podHost;
22 private static createDurationString(duration: number) {
23 const minutes = Math.floor(duration / 60);
24 const seconds = duration % 60;
25 const minutes_padding = minutes >= 10 ? '' : '0';
26 const seconds_padding = seconds >= 10 ? '' : '0';
28 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
42 thumbnailPath: string,
47 this.author = hash.author;
48 this.createdAt = new Date(hash.createdAt);
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.podHost = hash.podHost;
56 this.tags = hash.tags;
57 this.thumbnailPath = hash.thumbnailPath;
58 this.views = hash.views;
59 this.likes = hash.likes;
60 this.dislikes = hash.dislikes;
62 this.by = Video.createByString(hash.author, hash.podHost);
66 return this.isLocal === true && user && this.author === user.username;