aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/jobs/handlers/video-transcoder.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-05-15 22:22:03 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-05-20 09:57:40 +0200
commit65fcc3119c334b75dd13bcfdebf186afdc580a8f (patch)
tree4f2158c61a9b7c3f47cfa233d01413b946ee53c0 /server/lib/jobs/handlers/video-transcoder.js
parentd5f345ed4cfac4e1fa84dcb4fce1cda4d32f9c73 (diff)
downloadPeerTube-65fcc3119c334b75dd13bcfdebf186afdc580a8f.tar.gz
PeerTube-65fcc3119c334b75dd13bcfdebf186afdc580a8f.tar.zst
PeerTube-65fcc3119c334b75dd13bcfdebf186afdc580a8f.zip
First typescript iteration
Diffstat (limited to 'server/lib/jobs/handlers/video-transcoder.js')
-rw-r--r--server/lib/jobs/handlers/video-transcoder.js43
1 files changed, 0 insertions, 43 deletions
diff --git a/server/lib/jobs/handlers/video-transcoder.js b/server/lib/jobs/handlers/video-transcoder.js
deleted file mode 100644
index d2ad4f9c7..000000000
--- a/server/lib/jobs/handlers/video-transcoder.js
+++ /dev/null
@@ -1,43 +0,0 @@
1'use strict'
2
3const db = require('../../../initializers/database')
4const logger = require('../../../helpers/logger')
5const friends = require('../../../lib/friends')
6
7const VideoTranscoderHandler = {
8 process,
9 onError,
10 onSuccess
11}
12
13// ---------------------------------------------------------------------------
14
15function process (data, callback) {
16 db.Video.loadAndPopulateAuthorAndPodAndTags(data.id, function (err, video) {
17 if (err) return callback(err)
18
19 video.transcodeVideofile(function (err) {
20 return callback(err, video)
21 })
22 })
23}
24
25function onError (err, jobId, video, callback) {
26 logger.error('Error when transcoding video file in job %d.', jobId, { error: err })
27 return callback()
28}
29
30function onSuccess (data, jobId, video, callback) {
31 logger.info('Job %d is a success.', jobId)
32
33 video.toAddRemoteJSON(function (err, remoteVideo) {
34 if (err) return callback(err)
35
36 // Now we'll add the video's meta data to our friends
37 friends.addVideoToFriends(remoteVideo, null, callback)
38 })
39}
40
41// ---------------------------------------------------------------------------
42
43module.exports = VideoTranscoderHandler