diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-11 10:54:05 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-11 11:32:31 +0200 |
commit | 1bcb03a100d172903b877d6a0e4ed11d63b14f3d (patch) | |
tree | 704cf506d2099bbcc0f1db39e95c981ecc21548f /server/lib/job-queue/handlers | |
parent | ac2a5b54271e3c3090f863754350907ec916bac2 (diff) | |
download | PeerTube-1bcb03a100d172903b877d6a0e4ed11d63b14f3d.tar.gz PeerTube-1bcb03a100d172903b877d6a0e4ed11d63b14f3d.tar.zst PeerTube-1bcb03a100d172903b877d6a0e4ed11d63b14f3d.zip |
Use a class for youtube-dl
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r-- | server/lib/job-queue/handlers/video-import.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index ed2c5eac0..3067ce214 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts | |||
@@ -23,7 +23,6 @@ import { getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } fro | |||
23 | import { logger } from '../../../helpers/logger' | 23 | import { logger } from '../../../helpers/logger' |
24 | import { getSecureTorrentName } from '../../../helpers/utils' | 24 | import { getSecureTorrentName } from '../../../helpers/utils' |
25 | import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' | 25 | import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' |
26 | import { downloadYoutubeDLVideo } from '../../../helpers/youtube-dl' | ||
27 | import { CONFIG } from '../../../initializers/config' | 26 | import { CONFIG } from '../../../initializers/config' |
28 | import { VIDEO_IMPORT_TIMEOUT } from '../../../initializers/constants' | 27 | import { VIDEO_IMPORT_TIMEOUT } from '../../../initializers/constants' |
29 | import { sequelizeTypescript } from '../../../initializers/database' | 28 | import { sequelizeTypescript } from '../../../initializers/database' |
@@ -34,6 +33,8 @@ import { MThumbnail } from '../../../types/models/video/thumbnail' | |||
34 | import { federateVideoIfNeeded } from '../../activitypub/videos' | 33 | import { federateVideoIfNeeded } from '../../activitypub/videos' |
35 | import { Notifier } from '../../notifier' | 34 | import { Notifier } from '../../notifier' |
36 | import { generateVideoMiniature } from '../../thumbnail' | 35 | import { generateVideoMiniature } from '../../thumbnail' |
36 | import { YoutubeDL } from '@server/helpers/youtube-dl' | ||
37 | import { getEnabledResolutions } from '@server/lib/config' | ||
37 | 38 | ||
38 | async function processVideoImport (job: Bull.Job) { | 39 | async function processVideoImport (job: Bull.Job) { |
39 | const payload = job.data as VideoImportPayload | 40 | const payload = job.data as VideoImportPayload |
@@ -75,8 +76,10 @@ async function processYoutubeDLImport (job: Bull.Job, payload: VideoImportYoutub | |||
75 | videoImportId: videoImport.id | 76 | videoImportId: videoImport.id |
76 | } | 77 | } |
77 | 78 | ||
79 | const youtubeDL = new YoutubeDL(videoImport.targetUrl, getEnabledResolutions('vod')) | ||
80 | |||
78 | return processFile( | 81 | return processFile( |
79 | () => downloadYoutubeDLVideo(videoImport.targetUrl, payload.fileExt, VIDEO_IMPORT_TIMEOUT), | 82 | () => youtubeDL.downloadYoutubeDLVideo(payload.fileExt, VIDEO_IMPORT_TIMEOUT), |
80 | videoImport, | 83 | videoImport, |
81 | options | 84 | options |
82 | ) | 85 | ) |