15 thumbnailPath: string;
20 private static createByString(author: string, podHost: string) {
21 return author + '@' + podHost;
24 private static createDurationString(duration: number) {
25 const minutes = Math.floor(duration / 60);
26 const seconds = duration % 60;
27 const minutes_padding = minutes >= 10 ? '' : '0';
28 const seconds_padding = seconds >= 10 ? '' : '0';
30 return minutes_padding + minutes.toString() + ':' + seconds_padding + seconds.toString();
36 categoryLabel: string,
46 thumbnailPath: string,
51 this.author = hash.author;
52 this.createdAt = new Date(hash.createdAt);
53 this.categoryLabel = hash.categoryLabel;
54 this.licenceLabel = hash.licenceLabel;
55 this.description = hash.description;
56 this.duration = Video.createDurationString(hash.duration);
58 this.isLocal = hash.isLocal;
59 this.magnetUri = hash.magnetUri;
60 this.name = hash.name;
61 this.podHost = hash.podHost;
62 this.tags = hash.tags;
63 this.thumbnailPath = hash.thumbnailPath;
64 this.views = hash.views;
65 this.likes = hash.likes;
66 this.dislikes = hash.dislikes;
68 this.by = Video.createByString(hash.author, hash.podHost);
72 return this.isLocal === true && user && this.author === user.username;