aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/jobs/handlers/video-transcoder.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-02 12:20:26 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-03 15:31:26 +0200
commit40298b02546e8225dd21bf6048fe7f224aefc32a (patch)
tree0a0b981dbeb2af47810adff6553a0df995a03734 /server/lib/jobs/handlers/video-transcoder.ts
parentf0adb2701c1cf404ff63095f71e542bfe6d025ae (diff)
downloadPeerTube-40298b02546e8225dd21bf6048fe7f224aefc32a.tar.gz
PeerTube-40298b02546e8225dd21bf6048fe7f224aefc32a.tar.zst
PeerTube-40298b02546e8225dd21bf6048fe7f224aefc32a.zip
Implement video transcoding on server side
Diffstat (limited to 'server/lib/jobs/handlers/video-transcoder.ts')
-rw-r--r--server/lib/jobs/handlers/video-transcoder.ts34
1 files changed, 0 insertions, 34 deletions
diff --git a/server/lib/jobs/handlers/video-transcoder.ts b/server/lib/jobs/handlers/video-transcoder.ts
deleted file mode 100644
index 87d8ffa6a..000000000
--- a/server/lib/jobs/handlers/video-transcoder.ts
+++ /dev/null
@@ -1,34 +0,0 @@
1import { database as db } from '../../../initializers/database'
2import { logger } from '../../../helpers'
3import { addVideoToFriends } from '../../../lib'
4import { VideoInstance } from '../../../models'
5
6function process (data: { videoUUID: string }) {
7 return db.Video.loadByUUIDAndPopulateAuthorAndPodAndTags(data.videoUUID).then(video => {
8 // TODO: handle multiple resolutions
9 const videoFile = video.VideoFiles[0]
10 return video.transcodeVideofile(videoFile).then(() => video)
11 })
12}
13
14function onError (err: Error, jobId: number) {
15 logger.error('Error when transcoding video file in job %d.', jobId, err)
16 return Promise.resolve()
17}
18
19function onSuccess (jobId: number, video: VideoInstance) {
20 logger.info('Job %d is a success.', jobId)
21
22 video.toAddRemoteJSON().then(remoteVideo => {
23 // Now we'll add the video's meta data to our friends
24 return addVideoToFriends(remoteVideo, null)
25 })
26}
27
28// ---------------------------------------------------------------------------
29
30export {
31 process,
32 onError,
33 onSuccess
34}