aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-26 16:00:19 +0200
committerChocobozzz <me@florianbigard.com>2023-05-26 16:05:08 +0200
commitc56dd2807fe5d129907b9bf8c42656a8314d754b (patch)
treebd1b11237484bdb81d64bc29c87fcbdcb66e5ea0 /server/lib
parentc2eb81227b31d15c894b110d090308a9e3ac0606 (diff)
downloadPeerTube-c56dd2807fe5d129907b9bf8c42656a8314d754b.tar.gz
PeerTube-c56dd2807fe5d129907b9bf8c42656a8314d754b.tar.zst
PeerTube-c56dd2807fe5d129907b9bf8c42656a8314d754b.zip
Fix peertube subtitles import
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/video-pre-import.ts7
1 files changed, 5 insertions, 2 deletions
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 }: {
259 try { 259 try {
260 return await updateVideoMiniatureFromUrl({ downloadUrl, video, type }) 260 return await updateVideoMiniatureFromUrl({ downloadUrl, video, type })
261 } catch (err) { 261 } catch (err) {
262 logger.warn('Cannot process thumbnail %s from youtubedl.', downloadUrl, { err }) 262 logger.warn('Cannot process thumbnail %s from youtube-dl.', downloadUrl, { err })
263 } 263 }
264 } 264 }
265 return null 265 return null
@@ -269,10 +269,11 @@ async function processYoutubeSubtitles (youtubeDL: YoutubeDLWrapper, targetUrl:
269 try { 269 try {
270 const subtitles = await youtubeDL.getSubtitles() 270 const subtitles = await youtubeDL.getSubtitles()
271 271
272 logger.info('Will create %s subtitles from youtube import %s.', subtitles.length, targetUrl) 272 logger.info('Found %s subtitles candidates from youtube-dl import %s.', subtitles.length, targetUrl)
273 273
274 for (const subtitle of subtitles) { 274 for (const subtitle of subtitles) {
275 if (!await isVTTFileValid(subtitle.path)) { 275 if (!await isVTTFileValid(subtitle.path)) {
276 logger.info('%s is not a valid youtube-dl subtitle, skipping', subtitle.path)
276 await remove(subtitle.path) 277 await remove(subtitle.path)
277 continue 278 continue
278 } 279 }
@@ -289,6 +290,8 @@ async function processYoutubeSubtitles (youtubeDL: YoutubeDLWrapper, targetUrl:
289 await sequelizeTypescript.transaction(async t => { 290 await sequelizeTypescript.transaction(async t => {
290 await VideoCaptionModel.insertOrReplaceLanguage(videoCaption, t) 291 await VideoCaptionModel.insertOrReplaceLanguage(videoCaption, t)
291 }) 292 })
293
294 logger.info('Added %s youtube-dl subtitle', subtitle.path)
292 } 295 }
293 } catch (err) { 296 } catch (err) {
294 logger.warn('Cannot get video subtitles.', { err }) 297 logger.warn('Cannot get video subtitles.', { err })