aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-11 10:54:05 +0200
committerChocobozzz <me@florianbigard.com>2021-05-11 11:32:31 +0200
commit1bcb03a100d172903b877d6a0e4ed11d63b14f3d (patch)
tree704cf506d2099bbcc0f1db39e95c981ecc21548f /server/lib/job-queue/handlers
parentac2a5b54271e3c3090f863754350907ec916bac2 (diff)
downloadPeerTube-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.ts7
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
23import { logger } from '../../../helpers/logger' 23import { logger } from '../../../helpers/logger'
24import { getSecureTorrentName } from '../../../helpers/utils' 24import { getSecureTorrentName } from '../../../helpers/utils'
25import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent' 25import { createTorrentAndSetInfoHash, downloadWebTorrentVideo } from '../../../helpers/webtorrent'
26import { downloadYoutubeDLVideo } from '../../../helpers/youtube-dl'
27import { CONFIG } from '../../../initializers/config' 26import { CONFIG } from '../../../initializers/config'
28import { VIDEO_IMPORT_TIMEOUT } from '../../../initializers/constants' 27import { VIDEO_IMPORT_TIMEOUT } from '../../../initializers/constants'
29import { sequelizeTypescript } from '../../../initializers/database' 28import { sequelizeTypescript } from '../../../initializers/database'
@@ -34,6 +33,8 @@ import { MThumbnail } from '../../../types/models/video/thumbnail'
34import { federateVideoIfNeeded } from '../../activitypub/videos' 33import { federateVideoIfNeeded } from '../../activitypub/videos'
35import { Notifier } from '../../notifier' 34import { Notifier } from '../../notifier'
36import { generateVideoMiniature } from '../../thumbnail' 35import { generateVideoMiniature } from '../../thumbnail'
36import { YoutubeDL } from '@server/helpers/youtube-dl'
37import { getEnabledResolutions } from '@server/lib/config'
37 38
38async function processVideoImport (job: Bull.Job) { 39async 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 )