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.ts151
1 files changed, 0 insertions, 151 deletions
diff --git a/server/models/video-interface.ts b/server/models/video-interface.ts
deleted file mode 100644
index 7120f91cd..000000000
--- a/server/models/video-interface.ts
+++ /dev/null
@@ -1,151 +0,0 @@
1import * as Sequelize from 'sequelize'
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
50export namespace VideoMethods {
51 export type GenerateMagnetUri = () => string
52 export type GetVideoFilename = () => string
53 export type GetThumbnailName = () => string
54 export type GetPreviewName = () => string
55 export type GetTorrentName = () => string
56 export type IsOwned = () => boolean
57 export type ToFormatedJSON = () => FormatedVideo
58
59 export type ToAddRemoteJSONCallback = (err: Error, videoFormated?: FormatedAddRemoteVideo) => void
60 export type ToAddRemoteJSON = (callback: ToAddRemoteJSONCallback) => void
61
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
71 export type GetDurationFromFile = (videoPath, callback) => void
72
73 export type ListCallback = (err: Error, videoInstances: VideoInstance[]) => void
74 export type List = (callback: ListCallback) => void
75
76 export type ListForApiCallback = (err: Error, videoInstances?: VideoInstance[], total?: number) => void
77 export type ListForApi = (start: number, count: number, sort: string, callback: ListForApiCallback) => void
78
79 export type LoadByHostAndRemoteIdCallback = (err: Error, videoInstance: VideoInstance) => 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
99}
100
101export interface VideoClass {
102 generateMagnetUri: VideoMethods.GenerateMagnetUri
103 getVideoFilename: VideoMethods.GetVideoFilename
104 getThumbnailName: VideoMethods.GetThumbnailName
105 getPreviewName: VideoMethods.GetPreviewName
106 getTorrentName: VideoMethods.GetTorrentName
107 isOwned: VideoMethods.IsOwned
108 toFormatedJSON: VideoMethods.ToFormatedJSON
109 toAddRemoteJSON: VideoMethods.ToAddRemoteJSON
110 toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON
111 transcodeVideofile: VideoMethods.TranscodeVideofile
112
113 generateThumbnailFromData: VideoMethods.GenerateThumbnailFromData
114 getDurationFromFile: VideoMethods.GetDurationFromFile
115 list: VideoMethods.List
116 listForApi: VideoMethods.ListForApi
117 loadByHostAndRemoteId: VideoMethods.LoadByHostAndRemoteId
118 listOwnedAndPopulateAuthorAndTags: VideoMethods.ListOwnedAndPopulateAuthorAndTags
119 listOwnedByAuthor: VideoMethods.ListOwnedByAuthor
120 load: VideoMethods.Load
121 loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor
122 loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags
123 searchAndPopulateAuthorAndPodAndTags: VideoMethods.SearchAndPopulateAuthorAndPodAndTags
124}
125
126export interface VideoAttributes {
127 name: string
128 extname: string
129 remoteId: string
130 category: number
131 licence: number
132 language: number
133 nsfw: boolean
134 description: string
135 infoHash?: string
136 duration: number
137 views?: number
138 likes?: number
139 dislikes?: number
140
141 Author?: AuthorInstance
142 Tags?: VideoTagInstance[]
143}
144
145export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> {
146 id: string
147 createdAt: Date
148 updatedAt: Date
149}
150
151export interface VideoModel extends VideoClass, Sequelize.Model<VideoInstance, VideoAttributes> {}