]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/models/video-interface.ts
require -> import
[github/Chocobozzz/PeerTube.git] / server / models / video-interface.ts
CommitLineData
e02643f3
C
1import * as Sequelize from 'sequelize'
2
3export namespace VideoMethods {
4 export type GenerateMagnetUri = () => void
5 export type GetVideoFilename = () => void
6 export type GetThumbnailName = () => void
7 export type GetPreviewName = () => void
8 export type GetTorrentName = () => void
9 export type IsOwned = () => void
10 export type ToFormatedJSON = () => void
11 export type ToAddRemoteJSON = (callback) => void
12 export type ToUpdateRemoteJSON = (callback) => void
13 export type TranscodeVideofile = (callback) => void
14
15 export type GenerateThumbnailFromData = (video, thumbnailData, callback) => void
16 export type GetDurationFromFile = (videoPath, callback) => void
17 export type List = (callback) => void
18 export type ListForApi = (start, count, sort, callback) => void
19 export type LoadByHostAndRemoteId = (fromHost, remoteId, callback) => void
20 export type ListOwnedAndPopulateAuthorAndTags = (callback) => void
21 export type ListOwnedByAuthor = (author, callback) => void
22 export type Load = (id, callback) => void
23 export type LoadAndPopulateAuthor = (id, callback) => void
24 export type LoadAndPopulateAuthorAndPodAndTags = (id, callback) => void
25 export type SearchAndPopulateAuthorAndPodAndTags = (value, field, start, count, sort, callback) => void
26}
27
28export interface VideoClass {
29 generateMagnetUri: VideoMethods.GenerateMagnetUri
30 getVideoFilename: VideoMethods.GetVideoFilename
31 getThumbnailName: VideoMethods.GetThumbnailName
32 getPreviewName: VideoMethods.GetPreviewName
33 getTorrentName: VideoMethods.GetTorrentName
34 isOwned: VideoMethods.IsOwned
35 toFormatedJSON: VideoMethods.ToFormatedJSON
36 toAddRemoteJSON: VideoMethods.ToAddRemoteJSON
37 toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON
38 transcodeVideofile: VideoMethods.TranscodeVideofile
39
40 generateThumbnailFromData: VideoMethods.GenerateThumbnailFromData
41 getDurationFromFile: VideoMethods.GetDurationFromFile
42 list: VideoMethods.List
43 listForApi: VideoMethods.ListForApi
44 loadByHostAndRemoteId: VideoMethods.LoadByHostAndRemoteId
45 listOwnedAndPopulateAuthorAndTags: VideoMethods.ListOwnedAndPopulateAuthorAndTags
46 listOwnedByAuthor: VideoMethods.ListOwnedByAuthor
47 load: VideoMethods.Load
48 loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor
49 loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags
50 searchAndPopulateAuthorAndPodAndTags: VideoMethods.SearchAndPopulateAuthorAndPodAndTags
51}
52
53export interface VideoAttributes {
54 name: string
55 extname: string
56 remoteId: string
57 category: number
58 licence: number
59 language: number
60 nsfw: boolean
61 description: string
62 infoHash?: string
63 duration: number
64 views?: number
65 likes?: number
66 dislikes?: number
67}
68
69export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> {
70 id: string
71 createdAt: Date
72 updatedAt: Date
73}
74
75export interface VideoModel extends VideoClass, Sequelize.Model<VideoInstance, VideoAttributes> {}