More robust youtube-dl thumbnail import

This commit is contained in:
Chocobozzz 2021-10-08 15:06:45 +02:00
parent 52d1477ac4
commit 731a32e334
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 2 deletions

View File

@ -158,7 +158,11 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response)
// Process video thumbnail from url if processing from request.files failed // Process video thumbnail from url if processing from request.files failed
if (!thumbnailModel && youtubeDLInfo.thumbnailUrl) { if (!thumbnailModel && youtubeDLInfo.thumbnailUrl) {
try {
thumbnailModel = await processThumbnailFromUrl(youtubeDLInfo.thumbnailUrl, video) 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 // 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 // Process video preview from url if processing from request.files failed
if (!previewModel && youtubeDLInfo.thumbnailUrl) { if (!previewModel && youtubeDLInfo.thumbnailUrl) {
try {
previewModel = await processPreviewFromUrl(youtubeDLInfo.thumbnailUrl, video) previewModel = await processPreviewFromUrl(youtubeDLInfo.thumbnailUrl, video)
} catch (err) {
logger.warn('Cannot process preview %s from youtubedl.', youtubeDLInfo.thumbnailUrl, { err })
}
} }
const videoImport = await insertIntoDB({ const videoImport = await insertIntoDB({