+ } catch (err) {
+ await onImportError(err, tempVideoPath, videoImport)
+
+ throw err
+ }
+}
+
+async function refreshVideoImportFromDB (videoImport: MVideoImportDefault, videoFile: MVideoFile): Promise<MVideoImportDefaultFiles> {
+ // Refresh video, privacy may have changed
+ const video = await videoImport.Video.reload()
+ const videoWithFiles = Object.assign(video, { VideoFiles: [ videoFile ], VideoStreamingPlaylists: [] })
+
+ return Object.assign(videoImport, { Video: videoWithFiles })
+}
+
+async function generateMiniature (videoImportWithFiles: MVideoImportDefaultFiles, videoFile: MVideoFile, thumbnailType: ThumbnailType) {
+ // Generate miniature if the import did not created it
+ const needsMiniature = thumbnailType === ThumbnailType.MINIATURE
+ ? !videoImportWithFiles.Video.getMiniature()
+ : !videoImportWithFiles.Video.getPreview()