Improve torrent/video download
[oweals/peertube.git] / shared / models / videos / video.model.ts
1 import { VideoResolution } from '../../index'
2 import { Account } from '../actors'
3 import { Avatar } from '../avatars/avatar.model'
4 import { VideoChannel } from './video-channel.model'
5 import { VideoPrivacy } from './video-privacy.enum'
6
7 export interface VideoConstant <T> {
8   id: T
9   label: string
10 }
11
12 export interface VideoFile {
13   magnetUri: string
14   resolution: VideoConstant<VideoResolution>
15   size: number // Bytes
16   torrentUrl: string
17   torrentDownloadUrl: string
18   fileUrl: string
19   fileDownloadUrl: string
20 }
21
22 export interface Video {
23   id: number
24   uuid: string
25   createdAt: Date | string
26   updatedAt: Date | string
27   publishedAt: Date | string
28   category: VideoConstant<number>
29   licence: VideoConstant<number>
30   language: VideoConstant<string>
31   privacy: VideoConstant<VideoPrivacy>
32   description: string
33   duration: number
34   isLocal: boolean
35   name: string
36   thumbnailPath: string
37   previewPath: string
38   embedPath: string
39   views: number
40   likes: number
41   dislikes: number
42   nsfw: boolean
43
44   account: {
45     id: number
46     uuid: string
47     name: string
48     displayName: string
49     url: string
50     host: string
51     avatar: Avatar
52   }
53
54   channel: {
55     id: number
56     uuid: string
57     name: string
58     displayName: string
59     url: string
60     host: string
61     avatar: Avatar
62   }
63 }
64
65 export interface VideoDetails extends Video {
66   descriptionPath: string
67   support: string
68   channel: VideoChannel
69   tags: string[]
70   files: VideoFile[]
71   account: Account
72   commentsEnabled: boolean
73 }