aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video-interface.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video-interface.ts')
-rw-r--r--server/models/video-interface.ts118
1 files changed, 97 insertions, 21 deletions
diff --git a/server/models/video-interface.ts b/server/models/video-interface.ts
index b8dbeea35..7005f213c 100644
--- a/server/models/video-interface.ts
+++ b/server/models/video-interface.ts
@@ -1,28 +1,101 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2
3import { AuthorInstance } from './author-interface'
4import { VideoTagInstance } from './video-tag-interface'
5
6// Don't use barrel, import just what we need
7import { Video as FormatedVideo } from '../../shared/models/video.model'
8
9export type FormatedAddRemoteVideo = {
10 name: string
11 category: number
12 licence: number
13 language: number
14 nsfw: boolean
15 description: string
16 infoHash: string
17 remoteId: string
18 author: string
19 duration: number
20 thumbnailData: string
21 tags: string[]
22 createdAt: Date
23 updatedAt: Date
24 extname: string
25 views: number
26 likes: number
27 dislikes: number
28}
29
30export type FormatedUpdateRemoteVideo = {
31 name: string
32 category: number
33 licence: number
34 language: number
35 nsfw: boolean
36 description: string
37 infoHash: string
38 remoteId: string
39 author: string
40 duration: number
41 tags: string[]
42 createdAt: Date
43 updatedAt: Date
44 extname: string
45 views: number
46 likes: number
47 dislikes: number
48}
49
3export namespace VideoMethods { 50export namespace VideoMethods {
4 export type GenerateMagnetUri = () => void 51 export type GenerateMagnetUri = () => string
5 export type GetVideoFilename = () => void 52 export type GetVideoFilename = () => string
6 export type GetThumbnailName = () => void 53 export type GetThumbnailName = () => string
7 export type GetPreviewName = () => void 54 export type GetPreviewName = () => string
8 export type GetTorrentName = () => void 55 export type GetTorrentName = () => string
9 export type IsOwned = () => void 56 export type IsOwned = () => boolean
10 export type ToFormatedJSON = () => void 57 export type ToFormatedJSON = () => FormatedVideo
11 export type ToAddRemoteJSON = (callback) => void 58
12 export type ToUpdateRemoteJSON = (callback) => void 59 export type ToAddRemoteJSONCallback = (err: Error, videoFormated?: FormatedAddRemoteVideo) => void
13 export type TranscodeVideofile = (callback) => void 60 export type ToAddRemoteJSON = (callback: ToAddRemoteJSONCallback) => void
14 61
15 export type GenerateThumbnailFromData = (video, thumbnailData, callback) => void 62 export type ToUpdateRemoteJSON = () => FormatedUpdateRemoteVideo
63
64 export type TranscodeVideofileCallback = (err: Error) => void
65 export type TranscodeVideofile = (callback: TranscodeVideofileCallback) => void
66
67 export type GenerateThumbnailFromDataCallback = (err: Error, thumbnailName?: string) => void
68 export type GenerateThumbnailFromData = (video: VideoInstance, thumbnailData: string, callback: GenerateThumbnailFromDataCallback) => void
69
70 export type GetDurationFromFileCallback = (err: Error, duration?: number) => void
16 export type GetDurationFromFile = (videoPath, callback) => void 71 export type GetDurationFromFile = (videoPath, callback) => void
17 export type List = (callback) => void 72
18 export type ListForApi = (start, count, sort, callback) => void 73 export type ListCallback = () => void
19 export type LoadByHostAndRemoteId = (fromHost, remoteId, callback) => void 74 export type List = (callback: ListCallback) => void
20 export type ListOwnedAndPopulateAuthorAndTags = (callback) => void 75
21 export type ListOwnedByAuthor = (author, callback) => void 76 export type ListForApiCallback = (err: Error, videoInstances?: VideoInstance[], total?: number) => void
22 export type Load = (id, callback) => void 77 export type ListForApi = (start: number, count: number, sort: string, callback: ListForApiCallback) => void
23 export type LoadAndPopulateAuthor = (id, callback) => void 78
24 export type LoadAndPopulateAuthorAndPodAndTags = (id, callback) => void 79 export type LoadByHostAndRemoteIdCallback = (err: Error, videoInstance: VideoInstance) => void
25 export type SearchAndPopulateAuthorAndPodAndTags = (value, field, start, count, sort, callback) => void 80 export type LoadByHostAndRemoteId = (fromHost: string, remoteId: string, callback: LoadByHostAndRemoteIdCallback) => void
81
82 export type ListOwnedAndPopulateAuthorAndTagsCallback = (err: Error, videoInstances: VideoInstance[]) => void
83 export type ListOwnedAndPopulateAuthorAndTags = (callback: ListOwnedAndPopulateAuthorAndTagsCallback) => void
84
85 export type ListOwnedByAuthorCallback = (err: Error, videoInstances: VideoInstance[]) => void
86 export type ListOwnedByAuthor = (author: string, callback: ListOwnedByAuthorCallback) => void
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
26} 99}
27 100
28export interface VideoClass { 101export interface VideoClass {
@@ -64,6 +137,9 @@ export interface VideoAttributes {
64 views?: number 137 views?: number
65 likes?: number 138 likes?: number
66 dislikes?: number 139 dislikes?: number
140
141 Author?: AuthorInstance
142 Tags?: VideoTagInstance[]
67} 143}
68 144
69export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> { 145export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> {