]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/video/video-details.model.ts
Add ability to set video thumbnail/preview
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video-details.model.ts
index 1a956da7cb96ba246cd1acd37927fdf7f165c67a..cf6b71b608c33c7c019152a61c1a813dba88b8dc 100644 (file)
@@ -1,14 +1,10 @@
-import { Account } from '../../../../../shared/models/accounts'
-import { Video } from '../../shared/video/video.model'
-import { AuthUser } from '../../core'
 import {
-  VideoDetails as VideoDetailsServerModel,
-  VideoFile,
-  VideoChannel,
-  VideoResolution,
-  UserRight,
-  VideoPrivacy
+  UserRight, VideoChannel, VideoDetails as VideoDetailsServerModel, VideoFile, VideoPrivacy,
+  VideoResolution
 } from '../../../../../shared'
+import { Account } from '../../../../../shared/models/actors'
+import { AuthUser } from '../../core'
+import { Video } from '../../shared/video/video.model'
 
 export class VideoDetails extends Video implements VideoDetailsServerModel {
   accountName: string
@@ -46,6 +42,9 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
   privacy: VideoPrivacy
   privacyLabel: string
   account: Account
+  likesPercent: number
+  dislikesPercent: number
+  commentsEnabled: boolean
 
   constructor (hash: VideoDetailsServerModel) {
     super(hash)
@@ -56,6 +55,11 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
     this.files = hash.files
     this.channel = hash.channel
     this.account = hash.account
+    this.tags = hash.tags
+    this.commentsEnabled = hash.commentsEnabled
+
+    this.likesPercent = (this.likes / (this.likes + this.dislikes)) * 100
+    this.dislikesPercent = (this.dislikes / (this.likes + this.dislikes)) * 100
   }
 
   getAppropriateMagnetUri (actualDownloadSpeed = 0) {