aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-interface.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-02 12:20:26 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-03 15:31:26 +0200
commit40298b02546e8225dd21bf6048fe7f224aefc32a (patch)
tree0a0b981dbeb2af47810adff6553a0df995a03734 /server/models/video/video-interface.ts
parentf0adb2701c1cf404ff63095f71e542bfe6d025ae (diff)
downloadPeerTube-40298b02546e8225dd21bf6048fe7f224aefc32a.tar.gz
PeerTube-40298b02546e8225dd21bf6048fe7f224aefc32a.tar.zst
PeerTube-40298b02546e8225dd21bf6048fe7f224aefc32a.zip
Implement video transcoding on server side
Diffstat (limited to 'server/models/video/video-interface.ts')
-rw-r--r--server/models/video/video-interface.ts63
1 files changed, 13 insertions, 50 deletions
diff --git a/server/models/video/video-interface.ts b/server/models/video/video-interface.ts
index fb31c6a8f..340426f45 100644
--- a/server/models/video/video-interface.ts
+++ b/server/models/video/video-interface.ts
@@ -7,60 +7,17 @@ import { VideoFileAttributes, VideoFileInstance } from './video-file-interface'
7 7
8// Don't use barrel, import just what we need 8// Don't use barrel, import just what we need
9import { Video as FormattedVideo } from '../../../shared/models/videos/video.model' 9import { Video as FormattedVideo } from '../../../shared/models/videos/video.model'
10import { RemoteVideoUpdateData } from '../../../shared/models/pods/remote-video/remote-video-update-request.model'
11import { RemoteVideoCreateData } from '../../../shared/models/pods/remote-video/remote-video-create-request.model'
10import { ResultList } from '../../../shared/models/result-list.model' 12import { ResultList } from '../../../shared/models/result-list.model'
11 13
12export type FormattedRemoteVideoFile = {
13 infoHash: string
14 resolution: number
15 extname: string
16 size: number
17}
18
19export type FormattedAddRemoteVideo = {
20 uuid: string
21 name: string
22 category: number
23 licence: number
24 language: number
25 nsfw: boolean
26 description: string
27 author: string
28 duration: number
29 thumbnailData: string
30 tags: string[]
31 createdAt: Date
32 updatedAt: Date
33 views: number
34 likes: number
35 dislikes: number
36 files: FormattedRemoteVideoFile[]
37}
38
39export type FormattedUpdateRemoteVideo = {
40 uuid: string
41 name: string
42 category: number
43 licence: number
44 language: number
45 nsfw: boolean
46 description: string
47 author: string
48 duration: number
49 tags: string[]
50 createdAt: Date
51 updatedAt: Date
52 views: number
53 likes: number
54 dislikes: number
55 files: FormattedRemoteVideoFile[]
56}
57
58export namespace VideoMethods { 14export namespace VideoMethods {
59 export type GetThumbnailName = (this: VideoInstance) => string 15 export type GetThumbnailName = (this: VideoInstance) => string
60 export type GetPreviewName = (this: VideoInstance) => string 16 export type GetPreviewName = (this: VideoInstance) => string
61 export type IsOwned = (this: VideoInstance) => boolean 17 export type IsOwned = (this: VideoInstance) => boolean
62 export type ToFormattedJSON = (this: VideoInstance) => FormattedVideo 18 export type ToFormattedJSON = (this: VideoInstance) => FormattedVideo
63 19
20 export type GetOriginalFile = (this: VideoInstance) => VideoFileInstance
64 export type GenerateMagnetUri = (this: VideoInstance, videoFile: VideoFileInstance) => string 21 export type GenerateMagnetUri = (this: VideoInstance, videoFile: VideoFileInstance) => string
65 export type GetTorrentFileName = (this: VideoInstance, videoFile: VideoFileInstance) => string 22 export type GetTorrentFileName = (this: VideoInstance, videoFile: VideoFileInstance) => string
66 export type GetVideoFilename = (this: VideoInstance, videoFile: VideoFileInstance) => string 23 export type GetVideoFilename = (this: VideoInstance, videoFile: VideoFileInstance) => string
@@ -69,10 +26,12 @@ export namespace VideoMethods {
69 export type GetVideoFilePath = (this: VideoInstance, videoFile: VideoFileInstance) => string 26 export type GetVideoFilePath = (this: VideoInstance, videoFile: VideoFileInstance) => string
70 export type CreateTorrentAndSetInfoHash = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<void> 27 export type CreateTorrentAndSetInfoHash = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<void>
71 28
72 export type ToAddRemoteJSON = (this: VideoInstance) => Promise<FormattedAddRemoteVideo> 29 export type ToAddRemoteJSON = (this: VideoInstance) => Promise<RemoteVideoCreateData>
73 export type ToUpdateRemoteJSON = (this: VideoInstance) => FormattedUpdateRemoteVideo 30 export type ToUpdateRemoteJSON = (this: VideoInstance) => RemoteVideoUpdateData
74 31
75 export type TranscodeVideofile = (this: VideoInstance, inputVideoFile: VideoFileInstance) => Promise<void> 32 export type OptimizeOriginalVideofile = (this: VideoInstance) => Promise<void>
33 export type TranscodeOriginalVideofile = (this: VideoInstance, resolution: number) => Promise<void>
34 export type GetOriginalFileHeight = (this: VideoInstance) => Promise<number>
76 35
77 // Return thumbnail name 36 // Return thumbnail name
78 export type GenerateThumbnailFromData = (video: VideoInstance, thumbnailData: string) => Promise<string> 37 export type GenerateThumbnailFromData = (video: VideoInstance, thumbnailData: string) => Promise<string>
@@ -147,6 +106,7 @@ export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.In
147 createPreview: VideoMethods.CreatePreview 106 createPreview: VideoMethods.CreatePreview
148 createThumbnail: VideoMethods.CreateThumbnail 107 createThumbnail: VideoMethods.CreateThumbnail
149 createTorrentAndSetInfoHash: VideoMethods.CreateTorrentAndSetInfoHash 108 createTorrentAndSetInfoHash: VideoMethods.CreateTorrentAndSetInfoHash
109 getOriginalFile: VideoMethods.GetOriginalFile
150 generateMagnetUri: VideoMethods.GenerateMagnetUri 110 generateMagnetUri: VideoMethods.GenerateMagnetUri
151 getPreviewName: VideoMethods.GetPreviewName 111 getPreviewName: VideoMethods.GetPreviewName
152 getThumbnailName: VideoMethods.GetThumbnailName 112 getThumbnailName: VideoMethods.GetThumbnailName
@@ -161,9 +121,12 @@ export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.In
161 toAddRemoteJSON: VideoMethods.ToAddRemoteJSON 121 toAddRemoteJSON: VideoMethods.ToAddRemoteJSON
162 toFormattedJSON: VideoMethods.ToFormattedJSON 122 toFormattedJSON: VideoMethods.ToFormattedJSON
163 toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON 123 toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON
164 transcodeVideofile: VideoMethods.TranscodeVideofile 124 optimizeOriginalVideofile: VideoMethods.OptimizeOriginalVideofile
125 transcodeOriginalVideofile: VideoMethods.TranscodeOriginalVideofile
126 getOriginalFileHeight: VideoMethods.GetOriginalFileHeight
165 127
166 setTags: Sequelize.HasManySetAssociationsMixin<TagAttributes, string> 128 setTags: Sequelize.HasManySetAssociationsMixin<TagAttributes, string>
129 addVideoFile: Sequelize.HasManyAddAssociationMixin<VideoFileAttributes, string>
167 setVideoFiles: Sequelize.HasManySetAssociationsMixin<VideoFileAttributes, string> 130 setVideoFiles: Sequelize.HasManySetAssociationsMixin<VideoFileAttributes, string>
168} 131}
169 132