aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video-interface.ts
blob: b8dbeea357353409033bf5de2fc8d2a25179309f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import * as Sequelize from 'sequelize'

export namespace VideoMethods {
  export type GenerateMagnetUri = () => void
  export type GetVideoFilename = () => void
  export type GetThumbnailName = () => void
  export type GetPreviewName = () => void
  export type GetTorrentName = () => void
  export type IsOwned = () => void
  export type ToFormatedJSON = () => void
  export type ToAddRemoteJSON = (callback) => void
  export type ToUpdateRemoteJSON = (callback) => void
  export type TranscodeVideofile = (callback) => void

  export type GenerateThumbnailFromData = (video, thumbnailData, callback) => void
  export type GetDurationFromFile = (videoPath, callback) => void
  export type List = (callback) => void
  export type ListForApi = (start, count, sort, callback) => void
  export type LoadByHostAndRemoteId = (fromHost, remoteId, callback) => void
  export type ListOwnedAndPopulateAuthorAndTags = (callback) => void
  export type ListOwnedByAuthor = (author, callback) => void
  export type Load = (id, callback) => void
  export type LoadAndPopulateAuthor = (id, callback) => void
  export type LoadAndPopulateAuthorAndPodAndTags = (id, callback) => void
  export type SearchAndPopulateAuthorAndPodAndTags = (value, field, start, count, sort, callback) => void
}

export interface VideoClass {
  generateMagnetUri: VideoMethods.GenerateMagnetUri
  getVideoFilename: VideoMethods.GetVideoFilename
  getThumbnailName: VideoMethods.GetThumbnailName
  getPreviewName: VideoMethods.GetPreviewName
  getTorrentName: VideoMethods.GetTorrentName
  isOwned: VideoMethods.IsOwned
  toFormatedJSON: VideoMethods.ToFormatedJSON
  toAddRemoteJSON: VideoMethods.ToAddRemoteJSON
  toUpdateRemoteJSON: VideoMethods.ToUpdateRemoteJSON
  transcodeVideofile: VideoMethods.TranscodeVideofile

  generateThumbnailFromData: VideoMethods.GenerateThumbnailFromData
  getDurationFromFile: VideoMethods.GetDurationFromFile
  list: VideoMethods.List
  listForApi: VideoMethods.ListForApi
  loadByHostAndRemoteId: VideoMethods.LoadByHostAndRemoteId
  listOwnedAndPopulateAuthorAndTags: VideoMethods.ListOwnedAndPopulateAuthorAndTags
  listOwnedByAuthor: VideoMethods.ListOwnedByAuthor
  load: VideoMethods.Load
  loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor
  loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags
  searchAndPopulateAuthorAndPodAndTags: VideoMethods.SearchAndPopulateAuthorAndPodAndTags
}

export interface VideoAttributes {
  name: string
  extname: string
  remoteId: string
  category: number
  licence: number
  language: number
  nsfw: boolean
  description: string
  infoHash?: string
  duration: number
  views?: number
  likes?: number
  dislikes?: number
}

export interface VideoInstance extends VideoClass, VideoAttributes, Sequelize.Instance<VideoAttributes> {
  id: string
  createdAt: Date
  updatedAt: Date
}

export interface VideoModel extends VideoClass, Sequelize.Model<VideoInstance, VideoAttributes> {}