aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/jobs/handlers/video-transcoder.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-05-05 12:15:16 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-05-05 12:15:16 +0200
commit62326afb151a1062253ac8b08bb62ce3f01e1267 (patch)
tree0ab9950e84bdcc935e3c3531d061762eea2c0075 /server/lib/jobs/handlers/video-transcoder.js
parentfce897f326af14406ced2f71a00ae89ff297a550 (diff)
downloadPeerTube-62326afb151a1062253ac8b08bb62ce3f01e1267.tar.gz
PeerTube-62326afb151a1062253ac8b08bb62ce3f01e1267.tar.zst
PeerTube-62326afb151a1062253ac8b08bb62ce3f01e1267.zip
Server: Fix video propagation with transcoding enabled
Diffstat (limited to 'server/lib/jobs/handlers/video-transcoder.js')
-rw-r--r--server/lib/jobs/handlers/video-transcoder.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/server/lib/jobs/handlers/video-transcoder.js b/server/lib/jobs/handlers/video-transcoder.js
index 8524df3aa..d2ad4f9c7 100644
--- a/server/lib/jobs/handlers/video-transcoder.js
+++ b/server/lib/jobs/handlers/video-transcoder.js
@@ -2,6 +2,7 @@
2 2
3const db = require('../../../initializers/database') 3const db = require('../../../initializers/database')
4const logger = require('../../../helpers/logger') 4const logger = require('../../../helpers/logger')
5const friends = require('../../../lib/friends')
5 6
6const VideoTranscoderHandler = { 7const VideoTranscoderHandler = {
7 process, 8 process,
@@ -12,21 +13,29 @@ const VideoTranscoderHandler = {
12// --------------------------------------------------------------------------- 13// ---------------------------------------------------------------------------
13 14
14function process (data, callback) { 15function process (data, callback) {
15 db.Video.load(data.id, function (err, video) { 16 db.Video.loadAndPopulateAuthorAndPodAndTags(data.id, function (err, video) {
16 if (err) return callback(err) 17 if (err) return callback(err)
17 18
18 video.transcodeVideofile(callback) 19 video.transcodeVideofile(function (err) {
20 return callback(err, video)
21 })
19 }) 22 })
20} 23}
21 24
22function onError (err, jobId, callback) { 25function onError (err, jobId, video, callback) {
23 logger.error('Error when transcoding video file in job %d.', jobId, { error: err }) 26 logger.error('Error when transcoding video file in job %d.', jobId, { error: err })
24 return callback() 27 return callback()
25} 28}
26 29
27function onSuccess (data, jobId, callback) { 30function onSuccess (data, jobId, video, callback) {
28 logger.info('Job %d is a success.', jobId) 31 logger.info('Job %d is a success.', jobId)
29 return callback() 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 })
30} 39}
31 40
32// --------------------------------------------------------------------------- 41// ---------------------------------------------------------------------------