]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/jobs/handlers/video-transcoder.ts
Type functions
[github/Chocobozzz/PeerTube.git] / server / lib / jobs / handlers / video-transcoder.ts
index 43599356a729df8723e172395b7a916c2a4c4c1a..efa18ef2d66e3b4017ca619cbfbf873f94a2f024 100644 (file)
@@ -1,8 +1,9 @@
 import { database as db } from '../../../initializers/database'
 import { logger } from '../../../helpers'
 import { addVideoToFriends } from '../../../lib'
+import { VideoInstance } from '../../../models'
 
-function process (data, callback) {
+function process (data: { id: string }, callback: (err: Error, videoInstance?: VideoInstance) => void) {
   db.Video.loadAndPopulateAuthorAndPodAndTags(data.id, function (err, video) {
     if (err) return callback(err)
 
@@ -12,12 +13,12 @@ function process (data, callback) {
   })
 }
 
-function onError (err, jobId, video, callback) {
+function onError (err: Error, jobId: number, video: VideoInstance, callback: () => void) {
   logger.error('Error when transcoding video file in job %d.', jobId, { error: err })
   return callback()
 }
 
-function onSuccess (data, jobId, video, callback) {
+function onSuccess (data: any, jobId: number, video: VideoInstance, callback: (err: Error) => void) {
   logger.info('Job %d is a success.', jobId)
 
   video.toAddRemoteJSON(function (err, remoteVideo) {