From c56dd2807fe5d129907b9bf8c42656a8314d754b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 26 May 2023 16:00:19 +0200 Subject: Fix peertube subtitles import --- server/lib/video-pre-import.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'server/lib') diff --git a/server/lib/video-pre-import.ts b/server/lib/video-pre-import.ts index 796079875..df67dc953 100644 --- a/server/lib/video-pre-import.ts +++ b/server/lib/video-pre-import.ts @@ -259,7 +259,7 @@ async function forgeThumbnail ({ inputPath, video, downloadUrl, type }: { try { return await updateVideoMiniatureFromUrl({ downloadUrl, video, type }) } catch (err) { - logger.warn('Cannot process thumbnail %s from youtubedl.', downloadUrl, { err }) + logger.warn('Cannot process thumbnail %s from youtube-dl.', downloadUrl, { err }) } } return null @@ -269,10 +269,11 @@ async function processYoutubeSubtitles (youtubeDL: YoutubeDLWrapper, targetUrl: try { const subtitles = await youtubeDL.getSubtitles() - logger.info('Will create %s subtitles from youtube import %s.', subtitles.length, targetUrl) + logger.info('Found %s subtitles candidates from youtube-dl import %s.', subtitles.length, targetUrl) for (const subtitle of subtitles) { if (!await isVTTFileValid(subtitle.path)) { + logger.info('%s is not a valid youtube-dl subtitle, skipping', subtitle.path) await remove(subtitle.path) continue } @@ -289,6 +290,8 @@ async function processYoutubeSubtitles (youtubeDL: YoutubeDLWrapper, targetUrl: await sequelizeTypescript.transaction(async t => { await VideoCaptionModel.insertOrReplaceLanguage(videoCaption, t) }) + + logger.info('Added %s youtube-dl subtitle', subtitle.path) } } catch (err) { logger.warn('Cannot get video subtitles.', { err }) -- cgit v1.2.3