diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/lib/jobs/transcoding-job-scheduler/video-file-transcoder-handler.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip |
Move models to typescript-sequelize
Diffstat (limited to 'server/lib/jobs/transcoding-job-scheduler/video-file-transcoder-handler.ts')
-rw-r--r-- | server/lib/jobs/transcoding-job-scheduler/video-file-transcoder-handler.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/server/lib/jobs/transcoding-job-scheduler/video-file-transcoder-handler.ts b/server/lib/jobs/transcoding-job-scheduler/video-file-transcoder-handler.ts index 867580200..8957b4565 100644 --- a/server/lib/jobs/transcoding-job-scheduler/video-file-transcoder-handler.ts +++ b/server/lib/jobs/transcoding-job-scheduler/video-file-transcoder-handler.ts | |||
@@ -1,11 +1,10 @@ | |||
1 | import { VideoResolution } from '../../../../shared' | 1 | import { VideoResolution } from '../../../../shared' |
2 | import { logger } from '../../../helpers' | 2 | import { logger } from '../../../helpers' |
3 | import { database as db } from '../../../initializers/database' | 3 | import { VideoModel } from '../../../models/video/video' |
4 | import { VideoInstance } from '../../../models' | 4 | import { sendUpdateVideo } from '../../activitypub/send' |
5 | import { sendUpdateVideo } from '../../activitypub/send/send-update' | ||
6 | 5 | ||
7 | async function process (data: { videoUUID: string, resolution: VideoResolution }, jobId: number) { | 6 | async function process (data: { videoUUID: string, resolution: VideoResolution }, jobId: number) { |
8 | const video = await db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(data.videoUUID) | 7 | const video = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(data.videoUUID) |
9 | // No video, maybe deleted? | 8 | // No video, maybe deleted? |
10 | if (!video) { | 9 | if (!video) { |
11 | logger.info('Do not process job %d, video does not exist.', jobId, { videoUUID: video.uuid }) | 10 | logger.info('Do not process job %d, video does not exist.', jobId, { videoUUID: video.uuid }) |
@@ -22,13 +21,13 @@ function onError (err: Error, jobId: number) { | |||
22 | return Promise.resolve() | 21 | return Promise.resolve() |
23 | } | 22 | } |
24 | 23 | ||
25 | async function onSuccess (jobId: number, video: VideoInstance) { | 24 | async function onSuccess (jobId: number, video: VideoModel) { |
26 | if (video === undefined) return undefined | 25 | if (video === undefined) return undefined |
27 | 26 | ||
28 | logger.info('Job %d is a success.', jobId) | 27 | logger.info('Job %d is a success.', jobId) |
29 | 28 | ||
30 | // Maybe the video changed in database, refresh it | 29 | // Maybe the video changed in database, refresh it |
31 | const videoDatabase = await db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(video.uuid) | 30 | const videoDatabase = await VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(video.uuid) |
32 | // Video does not exist anymore | 31 | // Video does not exist anymore |
33 | if (!videoDatabase) return undefined | 32 | if (!videoDatabase) return undefined |
34 | 33 | ||