aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r--server/controllers/api/videos/import.ts10
-rw-r--r--server/controllers/api/videos/index.ts2
2 files changed, 7 insertions, 5 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index c689cb6f9..3b9b887e2 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -282,7 +282,7 @@ async function processPreview (req: express.Request, video: MVideoThumbnail): Pr
282 282
283async function processThumbnailFromUrl (url: string, video: MVideoThumbnail) { 283async function processThumbnailFromUrl (url: string, video: MVideoThumbnail) {
284 try { 284 try {
285 return createVideoMiniatureFromUrl(url, video, ThumbnailType.MINIATURE) 285 return createVideoMiniatureFromUrl({ downloadUrl: url, video, type: ThumbnailType.MINIATURE })
286 } catch (err) { 286 } catch (err) {
287 logger.warn('Cannot generate video thumbnail %s for %s.', url, video.url, { err }) 287 logger.warn('Cannot generate video thumbnail %s for %s.', url, video.url, { err })
288 return undefined 288 return undefined
@@ -291,14 +291,14 @@ async function processThumbnailFromUrl (url: string, video: MVideoThumbnail) {
291 291
292async function processPreviewFromUrl (url: string, video: MVideoThumbnail) { 292async function processPreviewFromUrl (url: string, video: MVideoThumbnail) {
293 try { 293 try {
294 return createVideoMiniatureFromUrl(url, video, ThumbnailType.PREVIEW) 294 return createVideoMiniatureFromUrl({ downloadUrl: url, video, type: ThumbnailType.PREVIEW })
295 } catch (err) { 295 } catch (err) {
296 logger.warn('Cannot generate video preview %s for %s.', url, video.url, { err }) 296 logger.warn('Cannot generate video preview %s for %s.', url, video.url, { err })
297 return undefined 297 return undefined
298 } 298 }
299} 299}
300 300
301function insertIntoDB (parameters: { 301async function insertIntoDB (parameters: {
302 video: MVideoThumbnail 302 video: MVideoThumbnail
303 thumbnailModel: MThumbnail 303 thumbnailModel: MThumbnail
304 previewModel: MThumbnail 304 previewModel: MThumbnail
@@ -309,7 +309,7 @@ function insertIntoDB (parameters: {
309}): Promise<MVideoImportFormattable> { 309}): Promise<MVideoImportFormattable> {
310 const { video, thumbnailModel, previewModel, videoChannel, tags, videoImportAttributes, user } = parameters 310 const { video, thumbnailModel, previewModel, videoChannel, tags, videoImportAttributes, user } = parameters
311 311
312 return sequelizeTypescript.transaction(async t => { 312 const videoImport = await sequelizeTypescript.transaction(async t => {
313 const sequelizeOptions = { transaction: t } 313 const sequelizeOptions = { transaction: t }
314 314
315 // Save video object in database 315 // Save video object in database
@@ -339,4 +339,6 @@ function insertIntoDB (parameters: {
339 339
340 return videoImport 340 return videoImport
341 }) 341 })
342
343 return videoImport
342} 344}
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index c2c5eb640..9504c40a4 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -215,7 +215,7 @@ async function addVideo (req: express.Request, res: express.Response) {
215 const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ 215 const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({
216 video, 216 video,
217 files: req.files, 217 files: req.files,
218 fallback: type => generateVideoMiniature(video, videoFile, type) 218 fallback: type => generateVideoMiniature({ video, videoFile, type })
219 }) 219 })
220 220
221 // Create the torrent file 221 // Create the torrent file