diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-23 09:50:57 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-24 16:26:21 +0200 |
commit | 3acc50844047a37698f0618fa235c138e386a053 (patch) | |
tree | e33243bf7fadbcf2df616fc41814245094fd881a /server/controllers/api/videos/import.ts | |
parent | 1735c825726edaa0af5035cb6cbb0cc0db502c6d (diff) | |
download | PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.gz PeerTube-3acc50844047a37698f0618fa235c138e386a053.tar.zst PeerTube-3acc50844047a37698f0618fa235c138e386a053.zip |
Upgrade sequelize
Diffstat (limited to 'server/controllers/api/videos/import.ts')
-rw-r--r-- | server/controllers/api/videos/import.ts | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index a4ec41d44..bfb690906 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -23,7 +23,7 @@ import { move, readFile } from 'fs-extra' | |||
23 | import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' | 23 | import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' |
24 | import { CONFIG } from '../../../initializers/config' | 24 | import { CONFIG } from '../../../initializers/config' |
25 | import { sequelizeTypescript } from '../../../initializers/database' | 25 | import { sequelizeTypescript } from '../../../initializers/database' |
26 | import { createVideoThumbnailFromExisting } from '../../../lib/thumbnail' | 26 | import { createVideoMiniatureFromExisting } from '../../../lib/thumbnail' |
27 | import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' | 27 | import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' |
28 | import { ThumbnailModel } from '../../../models/video/thumbnail' | 28 | import { ThumbnailModel } from '../../../models/video/thumbnail' |
29 | 29 | ||
@@ -204,7 +204,7 @@ async function processThumbnail (req: express.Request, video: VideoModel) { | |||
204 | if (thumbnailField) { | 204 | if (thumbnailField) { |
205 | const thumbnailPhysicalFile = thumbnailField[ 0 ] | 205 | const thumbnailPhysicalFile = thumbnailField[ 0 ] |
206 | 206 | ||
207 | return createVideoThumbnailFromExisting(thumbnailPhysicalFile.path, video, ThumbnailType.THUMBNAIL) | 207 | return createVideoMiniatureFromExisting(thumbnailPhysicalFile.path, video, ThumbnailType.MINIATURE) |
208 | } | 208 | } |
209 | 209 | ||
210 | return undefined | 210 | return undefined |
@@ -215,7 +215,7 @@ async function processPreview (req: express.Request, video: VideoModel) { | |||
215 | if (previewField) { | 215 | if (previewField) { |
216 | const previewPhysicalFile = previewField[0] | 216 | const previewPhysicalFile = previewField[0] |
217 | 217 | ||
218 | return createVideoThumbnailFromExisting(previewPhysicalFile.path, video, ThumbnailType.PREVIEW) | 218 | return createVideoMiniatureFromExisting(previewPhysicalFile.path, video, ThumbnailType.PREVIEW) |
219 | } | 219 | } |
220 | 220 | ||
221 | return undefined | 221 | return undefined |
@@ -238,14 +238,8 @@ function insertIntoDB (parameters: { | |||
238 | const videoCreated = await video.save(sequelizeOptions) | 238 | const videoCreated = await video.save(sequelizeOptions) |
239 | videoCreated.VideoChannel = videoChannel | 239 | videoCreated.VideoChannel = videoChannel |
240 | 240 | ||
241 | if (thumbnailModel) { | 241 | if (thumbnailModel) await videoCreated.addAndSaveThumbnail(thumbnailModel, t) |
242 | thumbnailModel.videoId = videoCreated.id | 242 | if (previewModel) await videoCreated.addAndSaveThumbnail(previewModel, t) |
243 | videoCreated.addThumbnail(await thumbnailModel.save({ transaction: t })) | ||
244 | } | ||
245 | if (previewModel) { | ||
246 | previewModel.videoId = videoCreated.id | ||
247 | videoCreated.addThumbnail(await previewModel.save({ transaction: t })) | ||
248 | } | ||
249 | 243 | ||
250 | await autoBlacklistVideoIfNeeded(video, videoChannel.Account.User, t) | 244 | await autoBlacklistVideoIfNeeded(video, videoChannel.Account.User, t) |
251 | 245 | ||