From f82416cc58f6c1d0496935e815f3fcb2fdda88ea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 8 Oct 2021 15:06:45 +0200 Subject: More robust youtube-dl thumbnail import --- server/controllers/api/videos/import.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index 5f90e4308..4265f3217 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -158,7 +158,11 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response) // Process video thumbnail from url if processing from request.files failed if (!thumbnailModel && youtubeDLInfo.thumbnailUrl) { - thumbnailModel = await processThumbnailFromUrl(youtubeDLInfo.thumbnailUrl, video) + try { + thumbnailModel = await processThumbnailFromUrl(youtubeDLInfo.thumbnailUrl, video) + } catch (err) { + logger.warn('Cannot process thumbnail %s from youtubedl.', youtubeDLInfo.thumbnailUrl, { err }) + } } // Process video preview from request.files @@ -166,7 +170,11 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response) // Process video preview from url if processing from request.files failed if (!previewModel && youtubeDLInfo.thumbnailUrl) { - previewModel = await processPreviewFromUrl(youtubeDLInfo.thumbnailUrl, video) + try { + previewModel = await processPreviewFromUrl(youtubeDLInfo.thumbnailUrl, video) + } catch (err) { + logger.warn('Cannot process preview %s from youtubedl.', youtubeDLInfo.thumbnailUrl, { err }) + } } const videoImport = await insertIntoDB({ -- cgit v1.2.3