1 import * as Bluebird from 'bluebird'
2 import * as Sequelize from 'sequelize'
3 import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object'
4 import { ResultList } from '../../../shared/models/result-list.model'
5 import { Video as FormattedVideo, VideoDetails as FormattedDetailsVideo } from '../../../shared/models/videos/video.model'
6 import { AccountVideoRateInstance } from '../account/account-video-rate-interface'
8 import { TagAttributes, TagInstance } from './tag-interface'
9 import { VideoChannelInstance } from './video-channel-interface'
10 import { VideoFileAttributes, VideoFileInstance } from './video-file-interface'
11 import { VideoShareInstance } from './video-share-interface'
13 export namespace VideoMethods {
14 export type GetThumbnailName = (this: VideoInstance) => string
15 export type GetPreviewName = (this: VideoInstance) => string
16 export type IsOwned = (this: VideoInstance) => boolean
17 export type ToFormattedJSON = (this: VideoInstance) => FormattedVideo
18 export type ToFormattedDetailsJSON = (this: VideoInstance) => FormattedDetailsVideo
20 export type GetOriginalFile = (this: VideoInstance) => VideoFileInstance
21 export type GetTorrentFileName = (this: VideoInstance, videoFile: VideoFileInstance) => string
22 export type GetVideoFilename = (this: VideoInstance, videoFile: VideoFileInstance) => string
23 export type CreatePreview = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<string>
24 export type CreateThumbnail = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<string>
25 export type GetVideoFilePath = (this: VideoInstance, videoFile: VideoFileInstance) => string
26 export type CreateTorrentAndSetInfoHash = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<void>
28 export type ToActivityPubObject = (this: VideoInstance) => VideoTorrentObject
30 export type OptimizeOriginalVideofile = (this: VideoInstance) => Promise<void>
31 export type TranscodeOriginalVideofile = (this: VideoInstance, resolution: number) => Promise<void>
32 export type GetOriginalFileHeight = (this: VideoInstance) => Promise<number>
33 export type GetEmbedPath = (this: VideoInstance) => string
34 export type GetThumbnailPath = (this: VideoInstance) => string
35 export type GetPreviewPath = (this: VideoInstance) => string
36 export type GetDescriptionPath = (this: VideoInstance) => string
37 export type GetTruncatedDescription = (this: VideoInstance) => string
38 export type GetCategoryLabel = (this: VideoInstance) => string
39 export type GetLicenceLabel = (this: VideoInstance) => string
40 export type GetLanguageLabel = (this: VideoInstance) => string
42 export type List = () => Bluebird<VideoInstance[]>
44 export type ListAllAndSharedByAccountForOutbox = (
48 ) => Bluebird< ResultList<VideoInstance> >
49 export type ListForApi = (start: number, count: number, sort: string) => Bluebird< ResultList<VideoInstance> >
50 export type ListUserVideosForApi = (userId: number, start: number, count: number, sort: string) => Bluebird< ResultList<VideoInstance> >
51 export type SearchAndPopulateAccountAndServerAndTags = (
57 ) => Bluebird< ResultList<VideoInstance> >
59 export type Load = (id: number) => Bluebird<VideoInstance>
60 export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Bluebird<VideoInstance>
61 export type LoadByUrlAndPopulateAccount = (url: string, t?: Sequelize.Transaction) => Bluebird<VideoInstance>
62 export type LoadAndPopulateAccountAndServerAndTags = (id: number) => Bluebird<VideoInstance>
63 export type LoadByUUIDAndPopulateAccountAndServerAndTags = (uuid: string) => Bluebird<VideoInstance>
64 export type LoadByUUIDOrURL = (uuid: string, url: string, t?: Sequelize.Transaction) => Bluebird<VideoInstance>
66 export type RemoveThumbnail = (this: VideoInstance) => Promise<void>
67 export type RemovePreview = (this: VideoInstance) => Promise<void>
68 export type RemoveFile = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<void>
69 export type RemoveTorrent = (this: VideoInstance, videoFile: VideoFileInstance) => Promise<void>
72 export interface VideoClass {
73 list: VideoMethods.List
74 listAllAndSharedByAccountForOutbox: VideoMethods.ListAllAndSharedByAccountForOutbox
75 listForApi: VideoMethods.ListForApi
76 listUserVideosForApi: VideoMethods.ListUserVideosForApi
77 load: VideoMethods.Load
78 loadAndPopulateAccountAndServerAndTags: VideoMethods.LoadAndPopulateAccountAndServerAndTags
79 loadByUUID: VideoMethods.LoadByUUID
80 loadByUrlAndPopulateAccount: VideoMethods.LoadByUrlAndPopulateAccount
81 loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL
82 loadByUUIDAndPopulateAccountAndServerAndTags: VideoMethods.LoadByUUIDAndPopulateAccountAndServerAndTags
83 searchAndPopulateAccountAndServerAndTags: VideoMethods.SearchAndPopulateAccountAndServerAndTags
86 export interface VideoAttributes {
109 VideoChannel?: VideoChannelInstance
111 VideoFiles?: VideoFileInstance[]
112 VideoShares?: VideoShareInstance[]
113 AccountVideoRates?: AccountVideoRateInstance[]
116 export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> {
117 createPreview: VideoMethods.CreatePreview
118 createThumbnail: VideoMethods.CreateThumbnail
119 createTorrentAndSetInfoHash: VideoMethods.CreateTorrentAndSetInfoHash
120 getOriginalFile: VideoMethods.GetOriginalFile
121 getPreviewName: VideoMethods.GetPreviewName
122 getPreviewPath: VideoMethods.GetPreviewPath
123 getThumbnailName: VideoMethods.GetThumbnailName
124 getThumbnailPath: VideoMethods.GetThumbnailPath
125 getTorrentFileName: VideoMethods.GetTorrentFileName
126 getVideoFilename: VideoMethods.GetVideoFilename
127 getVideoFilePath: VideoMethods.GetVideoFilePath
128 isOwned: VideoMethods.IsOwned
129 removeFile: VideoMethods.RemoveFile
130 removePreview: VideoMethods.RemovePreview
131 removeThumbnail: VideoMethods.RemoveThumbnail
132 removeTorrent: VideoMethods.RemoveTorrent
133 toActivityPubObject: VideoMethods.ToActivityPubObject
134 toFormattedJSON: VideoMethods.ToFormattedJSON
135 toFormattedDetailsJSON: VideoMethods.ToFormattedDetailsJSON
136 optimizeOriginalVideofile: VideoMethods.OptimizeOriginalVideofile
137 transcodeOriginalVideofile: VideoMethods.TranscodeOriginalVideofile
138 getOriginalFileHeight: VideoMethods.GetOriginalFileHeight
139 getEmbedPath: VideoMethods.GetEmbedPath
140 getDescriptionPath: VideoMethods.GetDescriptionPath
141 getTruncatedDescription: VideoMethods.GetTruncatedDescription
142 getCategoryLabel: VideoMethods.GetCategoryLabel
143 getLicenceLabel: VideoMethods.GetLicenceLabel
144 getLanguageLabel: VideoMethods.GetLanguageLabel
146 setTags: Sequelize.HasManySetAssociationsMixin<TagAttributes, string>
147 addVideoFile: Sequelize.HasManyAddAssociationMixin<VideoFileAttributes, string>
148 setVideoFiles: Sequelize.HasManySetAssociationsMixin<VideoFileAttributes, string>
151 export interface VideoModel extends VideoClass, Sequelize.Model<VideoInstance, VideoAttributes> {}