14 thumbnailPath: string;
19 private static createByString(author: string, podHost: string) {
20 return author + '@' + podHost;
23 private static createDurationString(duration: number) {
24 const minutes = Math.floor(duration / 60);
25 const seconds = duration % 60;
26 const minutes_padding = minutes >= 10 ? '' : '0';
27 const seconds_padding = seconds >= 10 ? '' : '0';
29 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
35 categoryLabel: string,
44 thumbnailPath: string,
49 this.author = hash.author;
50 this.createdAt = new Date(hash.createdAt);
51 this.categoryLabel = hash.categoryLabel;
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.podHost = hash.podHost;
59 this.tags = hash.tags;
60 this.thumbnailPath = hash.thumbnailPath;
61 this.views = hash.views;
62 this.likes = hash.likes;
63 this.dislikes = hash.dislikes;
65 this.by = Video.createByString(hash.author, hash.podHost);
69 return this.isLocal === true && user && this.author === user.username;