diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-05-15 22:22:03 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-05-20 09:57:40 +0200 |
commit | 65fcc3119c334b75dd13bcfdebf186afdc580a8f (patch) | |
tree | 4f2158c61a9b7c3f47cfa233d01413b946ee53c0 /server/lib/jobs/handlers/video-transcoder.js | |
parent | d5f345ed4cfac4e1fa84dcb4fce1cda4d32f9c73 (diff) | |
download | PeerTube-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.js | 43 |
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 | |||
3 | const db = require('../../../initializers/database') | ||
4 | const logger = require('../../../helpers/logger') | ||
5 | const friends = require('../../../lib/friends') | ||
6 | |||
7 | const VideoTranscoderHandler = { | ||
8 | process, | ||
9 | onError, | ||
10 | onSuccess | ||
11 | } | ||
12 | |||
13 | // --------------------------------------------------------------------------- | ||
14 | |||
15 | function 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 | |||
25 | function onError (err, jobId, video, callback) { | ||
26 | logger.error('Error when transcoding video file in job %d.', jobId, { error: err }) | ||
27 | return callback() | ||
28 | } | ||
29 | |||
30 | function 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 | |||
43 | module.exports = VideoTranscoderHandler | ||