Fix duplicates detection
authorChocobozzz <me@florianbigard.com>
Fri, 16 Feb 2018 10:03:42 +0000 (11:03 +0100)
committerChocobozzz <me@florianbigard.com>
Fri, 16 Feb 2018 10:03:42 +0000 (11:03 +0100)
server/tools/import-youtube.ts

index 82f48d8f7164addf8aa235e4f033552b234377fe..68893306f9c87efaca1609f7d5848e7b5b5323c8 100644 (file)
@@ -76,7 +76,7 @@ function processVideo (video: { name: string, url: string }, languageCode: numbe
 
     console.log('############################################################\n')
 
-    if (result.body.total !== 0) {
+    if (result.body.data.find(v => v.name === video.name)) {
       console.log('Video "%s" already exists, don\'t reupload it.\n', video.name)
       return res()
     }