1 import * as Sequelize from 'sequelize'
3 import { AuthorInstance } from './author-interface'
4 import { VideoTagInstance } from './video-tag-interface'
6 // Don't use barrel, import just what we need
7 import { Video as FormatedVideo } from '../../shared/models/video.model'
9 export type FormatedAddRemoteVideo = {
30 export type FormatedUpdateRemoteVideo = {
50 export 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
59 export type ToAddRemoteJSONCallback = (err: Error, videoFormated?: FormatedAddRemoteVideo) => void
60 export type ToAddRemoteJSON = (callback: ToAddRemoteJSONCallback) => void
62 export type ToUpdateRemoteJSON = () => FormatedUpdateRemoteVideo
64 export type TranscodeVideofileCallback = (err: Error) => void
65 export type TranscodeVideofile = (callback: TranscodeVideofileCallback) => void
67 export type GenerateThumbnailFromDataCallback = (err: Error, thumbnailName?: string) => void
68 export type GenerateThumbnailFromData = (video: VideoInstance, thumbnailData: string, callback: GenerateThumbnailFromDataCallback) => void
70 export type GetDurationFromFileCallback = (err: Error, duration?: number) => void
71 export type GetDurationFromFile = (videoPath, callback) => void
73 export type ListCallback = () => void
74 export type List = (callback: ListCallback) => void
76 export type ListForApiCallback = (err: Error, videoInstances?: VideoInstance[], total?: number) => void
77 export type ListForApi = (start: number, count: number, sort: string, callback: ListForApiCallback) => void
79 export type LoadByHostAndRemoteIdCallback = (err: Error, videoInstance: VideoInstance) => void
80 export type LoadByHostAndRemoteId = (fromHost: string, remoteId: string, callback: LoadByHostAndRemoteIdCallback) => void
82 export type ListOwnedAndPopulateAuthorAndTagsCallback = (err: Error, videoInstances: VideoInstance[]) => void
83 export type ListOwnedAndPopulateAuthorAndTags = (callback: ListOwnedAndPopulateAuthorAndTagsCallback) => void
85 export type ListOwnedByAuthorCallback = (err: Error, videoInstances: VideoInstance[]) => void
86 export type ListOwnedByAuthor = (author: string, callback: ListOwnedByAuthorCallback) => void
88 export type LoadCallback = (err: Error, videoInstance: VideoInstance) => void
89 export type Load = (id: string, callback: LoadCallback) => void
91 export type LoadAndPopulateAuthorCallback = (err: Error, videoInstance: VideoInstance) => void
92 export type LoadAndPopulateAuthor = (id: string, callback: LoadAndPopulateAuthorCallback) => void
94 export type LoadAndPopulateAuthorAndPodAndTagsCallback = (err: Error, videoInstance: VideoInstance) => void
95 export type LoadAndPopulateAuthorAndPodAndTags = (id: string, callback: LoadAndPopulateAuthorAndPodAndTagsCallback) => void
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
101 export 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
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
126 export interface VideoAttributes {
141 Author?: AuthorInstance
142 Tags?: VideoTagInstance[]
145 export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> {
151 export interface VideoModel extends VideoClass, Sequelize.Model<VideoInstance, VideoAttributes> {}