]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/job-queue/handlers/video-import.ts
add quarantine videos feature (#1637)
[github/Chocobozzz/PeerTube.git] / server / lib / job-queue / handlers / video-import.ts
index 29cd1198c7fedcddeabac4a2b0b21c1f782ca892..c5fc1061c2a8eb16d33d4447f072bcf0e56c6972 100644 (file)
@@ -196,7 +196,13 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide
       return videoImportUpdated
     })
 
-    Notifier.Instance.notifyOnNewVideo(videoImportUpdated.Video)
+    Notifier.Instance.notifyOnFinishedVideoImport(videoImportUpdated, true)
+
+    if (videoImportUpdated.Video.VideoBlacklist) {
+      Notifier.Instance.notifyOnVideoAutoBlacklist(videoImportUpdated.Video)
+    } else {
+      Notifier.Instance.notifyOnNewVideo(videoImportUpdated.Video)
+    }
 
     // Create transcoding jobs?
     if (videoImportUpdated.Video.state === VideoState.TO_TRANSCODE) {
@@ -206,7 +212,7 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide
         isNewVideo: true
       }
 
-      await JobQueue.Instance.createJob({ type: 'video-file', payload: dataInput })
+      await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput })
     }
 
   } catch (err) {
@@ -220,6 +226,8 @@ async function processFile (downloader: () => Promise<string>, videoImport: Vide
     videoImport.state = VideoImportState.FAILED
     await videoImport.save()
 
+    Notifier.Instance.notifyOnFinishedVideoImport(videoImport, false)
+
     throw err
   }
 }