aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/helpers/youtube-dl/youtube-dl-wrapper.ts4
-rw-r--r--server/tests/api/videos/video-imports.ts9
2 files changed, 9 insertions, 4 deletions
diff --git a/server/helpers/youtube-dl/youtube-dl-wrapper.ts b/server/helpers/youtube-dl/youtube-dl-wrapper.ts
index 6960fbae4..edbd28fa4 100644
--- a/server/helpers/youtube-dl/youtube-dl-wrapper.ts
+++ b/server/helpers/youtube-dl/youtube-dl-wrapper.ts
@@ -73,12 +73,11 @@ class YoutubeDLWrapper {
73 // Leave empty the extension, youtube-dl will add it 73 // Leave empty the extension, youtube-dl will add it
74 const pathWithoutExtension = generateVideoImportTmpPath(this.url, '') 74 const pathWithoutExtension = generateVideoImportTmpPath(this.url, '')
75 75
76 let timer: NodeJS.Timeout
77
78 logger.info('Importing youtubeDL video %s to %s', this.url, pathWithoutExtension, lTags()) 76 logger.info('Importing youtubeDL video %s to %s', this.url, pathWithoutExtension, lTags())
79 77
80 const youtubeDL = await YoutubeDLCLI.safeGet() 78 const youtubeDL = await YoutubeDLCLI.safeGet()
81 79
80 let timer: NodeJS.Timeout
82 const timeoutPromise = new Promise<string>((_, rej) => { 81 const timeoutPromise = new Promise<string>((_, rej) => {
83 timer = setTimeout(() => rej(new Error('YoutubeDL download timeout.')), timeout) 82 timer = setTimeout(() => rej(new Error('YoutubeDL download timeout.')), timeout)
84 }) 83 })
@@ -102,6 +101,7 @@ class YoutubeDLWrapper {
102 .catch(async err => { 101 .catch(async err => {
103 const path = await this.guessVideoPathWithExtension(pathWithoutExtension, fileExt) 102 const path = await this.guessVideoPathWithExtension(pathWithoutExtension, fileExt)
104 103
104 logger.debug('Error in youtube-dl import, deleting file %s.', path, { err, ...lTags() })
105 remove(path) 105 remove(path)
106 .catch(err => logger.error('Cannot remove file in youtubeDL timeout.', { err, ...lTags() })) 106 .catch(err => logger.error('Cannot remove file in youtubeDL timeout.', { err, ...lTags() }))
107 107
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index cfb188060..bb1627a27 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -345,9 +345,14 @@ describe('Test video imports', function () {
345 it('Should import a peertube video', async function () { 345 it('Should import a peertube video', async function () {
346 this.timeout(120_000) 346 this.timeout(120_000)
347 347
348 const toTest = [ FIXTURE_URLS.peertube_long ]
349
348 // TODO: include peertube_short when https://github.com/ytdl-org/youtube-dl/pull/29475 is merged 350 // TODO: include peertube_short when https://github.com/ytdl-org/youtube-dl/pull/29475 is merged
349 for (const targetUrl of [ FIXTURE_URLS.peertube_long ]) { 351 if (mode === 'yt-dlp') {
350 // for (const targetUrl of [ FIXTURE_URLS.peertube_long, FIXTURE_URLS.peertube_short ]) { 352 toTest.push(FIXTURE_URLS.peertube_short)
353 }
354
355 for (const targetUrl of toTest) {
351 await servers[0].config.disableTranscoding() 356 await servers[0].config.disableTranscoding()
352 357
353 const attributes = { 358 const attributes = {