]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/video/video-details.model.ts
Add disable webtorrent migration
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / video / video-details.model.ts
CommitLineData
ee79b60e 1import { VideoConstant, VideoDetails as VideoDetailsServerModel, VideoFile, VideoState } from '../../../../../shared'
47564bbe 2import { Video } from '../../shared/video/video.model'
ad9e39fb 3import { Account } from '@app/shared/account/account.model'
22a16e36 4import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
09209296
C
5import { VideoStreamingPlaylist } from '../../../../../shared/models/videos/video-streaming-playlist.model'
6import { VideoStreamingPlaylistType } from '../../../../../shared/models/videos/video-streaming-playlist.type'
404b54e1
C
7
8export class VideoDetails extends Video implements VideoDetailsServerModel {
09700934 9 descriptionPath: string
2422c46b 10 support: string
09700934 11 channel: VideoChannel
404b54e1 12 tags: string[]
404b54e1 13 files: VideoFile[]
b1fa3eba 14 account: Account
09700934 15 commentsEnabled: boolean
7f2cfe3a 16 downloadEnabled: boolean
09700934 17
2186386c
C
18 waitTranscoding: boolean
19 state: VideoConstant<VideoState>
20
6a9e1d42
C
21 likesPercent: number
22 dislikesPercent: number
404b54e1 23
09209296
C
24 trackerUrls: string[]
25
26 streamingPlaylists: VideoStreamingPlaylist[]
27
7ce44a74
C
28 constructor (hash: VideoDetailsServerModel, translations = {}) {
29 super(hash, translations)
404b54e1 30
2de96f4d 31 this.descriptionPath = hash.descriptionPath
404b54e1 32 this.files = hash.files
22a16e36 33 this.channel = new VideoChannel(hash.channel)
ad9e39fb 34 this.account = new Account(hash.account)
d48ff09d 35 this.tags = hash.tags
07fa4c97 36 this.support = hash.support
47564bbe 37 this.commentsEnabled = hash.commentsEnabled
7f2cfe3a 38 this.downloadEnabled = hash.downloadEnabled
6a9e1d42 39
09209296
C
40 this.trackerUrls = hash.trackerUrls
41 this.streamingPlaylists = hash.streamingPlaylists
42
20b40b19 43 this.buildLikeAndDislikePercents()
404b54e1
C
44 }
45
20b40b19
C
46 buildLikeAndDislikePercents () {
47 this.likesPercent = (this.likes / (this.likes + this.dislikes)) * 100
48 this.dislikesPercent = (this.dislikes / (this.likes + this.dislikes)) * 100
49 }
09209296
C
50
51 getHlsPlaylist () {
52 return this.streamingPlaylists.find(p => p.type === VideoStreamingPlaylistType.HLS)
53 }
65659166
C
54
55 hasHlsPlaylist () {
56 return !!this.getHlsPlaylist()
57 }
404b54e1 58}