ActivityPub-federated video streaming platform using P2P directly in your web browser
Guess if we need to generate the thumbnail for imports
Chocobozzze3b4c084cd09
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.tsindex 96499dffb2..01f41e7bc2 100644--- a/server/controllers/api/videos/import.ts+++ b/server/controllers/api/videos/import.ts@@ -218,8 +218,6 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)const payload = {type: 'youtube-dl' as 'youtube-dl',videoImportId: videoImport.id,- generateThumbnail: !thumbnailModel,- generatePreview: !previewModel,fileExt: `.${youtubeDLInfo.ext || 'mp4'}`}await JobQueue.Instance.createJobWithPromise({ type: 'video-import', payload })diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.tsindex 9125b50e1e..1e5e52b58f 100644--- a/server/lib/job-queue/handlers/video-import.ts+++ b/server/lib/job-queue/handlers/video-import.ts@@ -57,10 +57,7 @@ async function processTorrentImport (job: Bull.Job, payload: VideoImportTorrentPconst options = {type: payload.type,- videoImportId: payload.videoImportId,-- generateThumbnail: true,- generatePreview: true+ videoImportId: payload.videoImportId}const target = {torrentName: videoImport.torrentName ? getSecureTorrentName(videoImport.torrentName) : undefined,@@ -75,10 +72,7 @@ async function processYoutubeDLImport (job: Bull.Job, payload: VideoImportYoutubconst videoImport = await getVideoImportOrDie(payload.videoImportId)const options = {type: payload.type,- videoImportId: videoImport.id,-- generateThumbnail: payload.generateThumbnail,- generatePreview: payload.generatePreview+ videoImportId: videoImport.id}return processFile(@@ -100,9 +94,6 @@ async function getVideoImportOrDie (videoImportId: number) {type ProcessFileOptions = {type: VideoImportYoutubeDLPayloadType | VideoImportTorrentPayloadTypevideoImportId: number-- generateThumbnail: boolean- generatePreview: boolean}async function processFile (downloader: () => Promise<string>, videoImport: MVideoImportDefault, options: ProcessFileOptions) {let tempVideoPath: string@@ -167,18 +158,18 @@ async function processFile (downloader: () => Promise<string>, videoImport: MVidawait move(tempVideoPath, videoDestFile)tempVideoPath = null // This path is not used anymore- // Process thumbnail+ // Generate miniature if the import did not created itlet thumbnailModel: MThumbnaillet thumbnailSave: object- if (options.generateThumbnail) {+ if (!videoImportWithFiles.Video.getMiniature()) {thumbnailModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.MINIATURE)thumbnailSave = thumbnailModel.toJSON()}- // Process preview+ // Generate preview if the import did not created itlet previewModel: MThumbnaillet previewSave: object- if (options.generatePreview) {+ if (!videoImportWithFiles.Video.getPreview()) {previewModel = await generateVideoMiniature(videoImportWithFiles.Video, videoFile, ThumbnailType.PREVIEW)previewSave = previewModel.toJSON()}diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.tsindex 44f92abf15..07d7efe229 100644--- a/shared/models/server/job.model.ts+++ b/shared/models/server/job.model.ts@@ -80,8 +80,6 @@ export type VideoImportYoutubeDLPayload = {type: VideoImportYoutubeDLPayloadTypevideoImportId: number- generateThumbnail: boolean- generatePreview: booleanfileExt?: string}export type VideoImportTorrentPayload = {