From 02988fdc0bdd345bddf89171d258822cab4229d6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Feb 2018 18:40:24 +0100 Subject: Fix remote image fetching --- server/tools/import-youtube.ts | 7 +++++-- server/tools/upload.ts | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'server/tools') diff --git a/server/tools/import-youtube.ts b/server/tools/import-youtube.ts index 295109cd8..ab91afbc0 100644 --- a/server/tools/import-youtube.ts +++ b/server/tools/import-youtube.ts @@ -62,7 +62,7 @@ async function run () { console.log('Will download and upload %d videos.\n', videos.length) for (const video of videos) { - await processVideo(video, program['languageCode']) + await processVideo(video, program['language']) } console.log('I\'m finished!') @@ -107,7 +107,10 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, languag const licence = getLicence(videoInfo.license) let tags = [] if (Array.isArray(videoInfo.tags)) { - tags = videoInfo.tags.filter(t => t.length < CONSTRAINTS_FIELDS.VIDEOS.TAG.max).slice(0, 5) + tags = videoInfo.tags + .filter(t => t.length < CONSTRAINTS_FIELDS.VIDEOS.TAG.max) + .map(t => t.normalize()) + .slice(0, 5) } let thumbnailfile diff --git a/server/tools/upload.ts b/server/tools/upload.ts index de8ff8d26..97e24dc88 100644 --- a/server/tools/upload.ts +++ b/server/tools/upload.ts @@ -20,6 +20,7 @@ program .option('-d, --video-description ', 'Video description') .option('-t, --tags ', 'Video tags', list) .option('-b, --thumbnail ', 'Thumbnail path') + .option('-v, --preview ', 'Preview path') .option('-f, --file ', 'Video absolute file path') .parse(process.argv) @@ -74,7 +75,8 @@ async function run () { tags: program['tags'], commentsEnabled: program['commentsEnabled'], fixture: program['file'], - thumbnailfile: program['thumbnailPath'] + thumbnailfile: program['thumbnailPath'], + previewfile: program['previewPath'] } await uploadVideo(program['url'], accessToken, videoAttributes) -- cgit v1.2.3