aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-19 14:58:16 +0100
committerChocobozzz <me@florianbigard.com>2022-01-19 14:58:16 +0100
commitd511df28906f84c7d25ecb24e41515ed549ff276 (patch)
treebc9caa33fae684e9971068011dd10243c7d0fe60 /server/lib/job-queue/handlers
parent419b520ca4434d17f3505013174e195c3a316716 (diff)
downloadPeerTube-d511df28906f84c7d25ecb24e41515ed549ff276.tar.gz
PeerTube-d511df28906f84c7d25ecb24e41515ed549ff276.tar.zst
PeerTube-d511df28906f84c7d25ecb24e41515ed549ff276.zip
Add ability to filter my imports by target URL
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/video-import.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts
index cb79725aa..1630ecabd 100644
--- a/server/lib/job-queue/handlers/video-import.ts
+++ b/server/lib/job-queue/handlers/video-import.ts
@@ -42,7 +42,7 @@ import { generateVideoMiniature } from '../../thumbnail'
42async function processVideoImport (job: Job) { 42async function processVideoImport (job: Job) {
43 const payload = job.data as VideoImportPayload 43 const payload = job.data as VideoImportPayload
44 44
45 const videoImport = await getVideoImportOrDie(payload.videoImportId) 45 const videoImport = await getVideoImportOrDie(payload)
46 if (videoImport.state === VideoImportState.CANCELLED) { 46 if (videoImport.state === VideoImportState.CANCELLED) {
47 logger.info('Do not process import since it has been cancelled', { payload }) 47 logger.info('Do not process import since it has been cancelled', { payload })
48 return 48 return
@@ -89,10 +89,10 @@ async function processYoutubeDLImport (job: Job, videoImport: MVideoImportDefaul
89 ) 89 )
90} 90}
91 91
92async function getVideoImportOrDie (videoImportId: number) { 92async function getVideoImportOrDie (payload: VideoImportPayload) {
93 const videoImport = await VideoImportModel.loadAndPopulateVideo(videoImportId) 93 const videoImport = await VideoImportModel.loadAndPopulateVideo(payload.videoImportId)
94 if (!videoImport || !videoImport.Video) { 94 if (!videoImport || !videoImport.Video) {
95 throw new Error('Cannot import video %s: the video import or video linked to this import does not exist anymore.') 95 throw new Error(`Cannot import video ${payload.videoImportId}: the video import or video linked to this import does not exist anymore.`)
96 } 96 }
97 97
98 return videoImport 98 return videoImport