diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-02 12:20:26 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-03 15:31:26 +0200 |
commit | 40298b02546e8225dd21bf6048fe7f224aefc32a (patch) | |
tree | 0a0b981dbeb2af47810adff6553a0df995a03734 /server/lib/jobs/handlers/video-transcoder.ts | |
parent | f0adb2701c1cf404ff63095f71e542bfe6d025ae (diff) | |
download | PeerTube-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.ts | 34 |
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 @@ | |||
1 | import { database as db } from '../../../initializers/database' | ||
2 | import { logger } from '../../../helpers' | ||
3 | import { addVideoToFriends } from '../../../lib' | ||
4 | import { VideoInstance } from '../../../models' | ||
5 | |||
6 | function 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 | |||
14 | function onError (err: Error, jobId: number) { | ||
15 | logger.error('Error when transcoding video file in job %d.', jobId, err) | ||
16 | return Promise.resolve() | ||
17 | } | ||
18 | |||
19 | function 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 | |||
30 | export { | ||
31 | process, | ||
32 | onError, | ||
33 | onSuccess | ||
34 | } | ||