aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-interface.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-interface.ts')
-rw-r--r--server/models/video/video-interface.ts70
1 files changed, 30 insertions, 40 deletions
diff --git a/server/models/video/video-interface.ts b/server/models/video/video-interface.ts
index 4b591b9e7..c3e3365d5 100644
--- a/server/models/video/video-interface.ts
+++ b/server/models/video/video-interface.ts
@@ -1,10 +1,12 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird'
2 3
3import { AuthorInstance } from './author-interface' 4import { AuthorInstance } from './author-interface'
4import { VideoTagInstance } from './video-tag-interface' 5import { TagAttributes, TagInstance } from './tag-interface'
5 6
6// Don't use barrel, import just what we need 7// Don't use barrel, import just what we need
7import { Video as FormatedVideo } from '../../../shared/models/video.model' 8import { Video as FormatedVideo } from '../../../shared/models/video.model'
9import { ResultList } from '../../../shared/models/result-list.model'
8 10
9export type FormatedAddRemoteVideo = { 11export type FormatedAddRemoteVideo = {
10 name: string 12 name: string
@@ -56,46 +58,32 @@ export namespace VideoMethods {
56 export type IsOwned = (this: VideoInstance) => boolean 58 export type IsOwned = (this: VideoInstance) => boolean
57 export type ToFormatedJSON = (this: VideoInstance) => FormatedVideo 59 export type ToFormatedJSON = (this: VideoInstance) => FormatedVideo
58 60
59 export type ToAddRemoteJSONCallback = (err: Error, videoFormated?: FormatedAddRemoteVideo) => void 61 export type ToAddRemoteJSON = (this: VideoInstance) => Promise<FormatedAddRemoteVideo>
60 export type ToAddRemoteJSON = (this: VideoInstance, callback: ToAddRemoteJSONCallback) => void
61
62 export type ToUpdateRemoteJSON = (this: VideoInstance) => FormatedUpdateRemoteVideo 62 export type ToUpdateRemoteJSON = (this: VideoInstance) => FormatedUpdateRemoteVideo
63 63
64 export type TranscodeVideofileCallback = (err: Error) => void 64 export type TranscodeVideofile = (this: VideoInstance) => Promise<void>
65 export type TranscodeVideofile = (this: VideoInstance, callback: TranscodeVideofileCallback) => void 65
66 66 // Return thumbnail name
67 export type GenerateThumbnailFromDataCallback = (err: Error, thumbnailName?: string) => void 67 export type GenerateThumbnailFromData = (video: VideoInstance, thumbnailData: string) => Promise<string>
68 export type GenerateThumbnailFromData = (video: VideoInstance, thumbnailData: string, callback: GenerateThumbnailFromDataCallback) => void 68 export type GetDurationFromFile = (videoPath: string) => Promise<number>
69 69
70 export type GetDurationFromFileCallback = (err: Error, duration?: number) => void 70 export type List = () => Promise<VideoInstance[]>
71 export type GetDurationFromFile = (videoPath, callback) => void 71 export type ListOwnedAndPopulateAuthorAndTags = () => Promise<VideoInstance[]>
72 72 export type ListOwnedByAuthor = (author: string) => Promise<VideoInstance[]>
73 export type ListCallback = (err: Error, videoInstances: VideoInstance[]) => void 73
74 export type List = (callback: ListCallback) => void 74 export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<VideoInstance> >
75 75 export type SearchAndPopulateAuthorAndPodAndTags = (
76 export type ListForApiCallback = (err: Error, videoInstances?: VideoInstance[], total?: number) => void 76 value: string,
77 export type ListForApi = (start: number, count: number, sort: string, callback: ListForApiCallback) => void 77 field: string,
78 78 start: number,
79 export type LoadByHostAndRemoteIdCallback = (err: Error, videoInstance: VideoInstance) => void 79 count: number,
80 export type LoadByHostAndRemoteId = (fromHost: string, remoteId: string, callback: LoadByHostAndRemoteIdCallback) => void 80 sort: string
81 81 ) => Promise< ResultList<VideoInstance> >
82 export type ListOwnedAndPopulateAuthorAndTagsCallback = (err: Error, videoInstances: VideoInstance[]) => void 82
83 export type ListOwnedAndPopulateAuthorAndTags = (callback: ListOwnedAndPopulateAuthorAndTagsCallback) => void 83 export type Load = (id: string) => Promise<VideoInstance>
84 84 export type LoadByHostAndRemoteId = (fromHost: string, remoteId: string) => Promise<VideoInstance>
85 export type ListOwnedByAuthorCallback = (err: Error, videoInstances: VideoInstance[]) => void 85 export type LoadAndPopulateAuthor = (id: string) => Promise<VideoInstance>
86 export type ListOwnedByAuthor = (author: string, callback: ListOwnedByAuthorCallback) => void 86 export type LoadAndPopulateAuthorAndPodAndTags = (id: string) => Promise<VideoInstance>
87
88 export type LoadCallback = (err: Error, videoInstance: VideoInstance) => void
89 export type Load = (id: string, callback: LoadCallback) => void
90
91 export type LoadAndPopulateAuthorCallback = (err: Error, videoInstance: VideoInstance) => void
92 export type LoadAndPopulateAuthor = (id: string, callback: LoadAndPopulateAuthorCallback) => void
93
94 export type LoadAndPopulateAuthorAndPodAndTagsCallback = (err: Error, videoInstance: VideoInstance) => void
95 export type LoadAndPopulateAuthorAndPodAndTags = (id: string, callback: LoadAndPopulateAuthorAndPodAndTagsCallback) => void
96
97 export type SearchAndPopulateAuthorAndPodAndTagsCallback = (err: Error, videoInstances?: VideoInstance[], total?: number) => void
98 export type SearchAndPopulateAuthorAndPodAndTags = (value: string, field: string, start: number, count: number, sort: string, callback: SearchAndPopulateAuthorAndPodAndTagsCallback) => void
99} 87}
100 88
101export interface VideoClass { 89export interface VideoClass {
@@ -139,7 +127,7 @@ export interface VideoAttributes {
139 dislikes?: number 127 dislikes?: number
140 128
141 Author?: AuthorInstance 129 Author?: AuthorInstance
142 Tags?: VideoTagInstance[] 130 Tags?: TagInstance[]
143} 131}
144 132
145export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> { 133export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> {
@@ -157,6 +145,8 @@ export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.In
157 toAddRemoteJSON: VideoMethods.ToAddRemoteJSON 145 toAddRemoteJSON: VideoMethods.ToAddRemoteJSON
158 toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON 146 toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON
159 transcodeVideofile: VideoMethods.TranscodeVideofile 147 transcodeVideofile: VideoMethods.TranscodeVideofile
148
149 setTags: Sequelize.HasManySetAssociationsMixin<TagAttributes, string>
160} 150}
161 151
162export interface VideoModel extends VideoClass, Sequelize.Model<VideoInstance, VideoAttributes> {} 152export interface VideoModel extends VideoClass, Sequelize.Model<VideoInstance, VideoAttributes> {}