From ea139ca870fcea1d784d0b2c8016a7cfa9a0a4c0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Aug 2022 11:40:07 +0200 Subject: Display error on youtube-dl get info failure --- server/helpers/youtube-dl/youtube-dl-cli.ts | 2 ++ server/helpers/youtube-dl/youtube-dl-wrapper.ts | 2 ++ server/tests/api/server/jobs.ts | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/helpers/youtube-dl/youtube-dl-cli.ts b/server/helpers/youtube-dl/youtube-dl-cli.ts index 5a87b99b4..508055b85 100644 --- a/server/helpers/youtube-dl/youtube-dl-cli.ts +++ b/server/helpers/youtube-dl/youtube-dl-cli.ts @@ -126,6 +126,8 @@ export class YoutubeDLCLI { const completeArgs = additionalYoutubeDLArgs.concat([ '--dump-json', '-f', format ]) const data = await this.run({ url, args: completeArgs, processOptions }) + if (!data) return undefined + const info = data.map(this.parseInfo) return info.length === 1 diff --git a/server/helpers/youtube-dl/youtube-dl-wrapper.ts b/server/helpers/youtube-dl/youtube-dl-wrapper.ts index 7cd5e3310..3264cc9ff 100644 --- a/server/helpers/youtube-dl/youtube-dl-wrapper.ts +++ b/server/helpers/youtube-dl/youtube-dl-wrapper.ts @@ -39,6 +39,8 @@ class YoutubeDLWrapper { processOptions }) + if (!info) throw new Error(`YoutubeDL could not get info from ${this.url}`) + if (info.is_live === true) throw new Error('Cannot download a live streaming.') const infoBuilder = new YoutubeDLInfoBuilder(info) diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts index 211e32b1e..d0e6df719 100644 --- a/server/tests/api/server/jobs.ts +++ b/server/tests/api/server/jobs.ts @@ -27,7 +27,7 @@ describe('Test jobs', function () { }) it('Should create some jobs', async function () { - this.timeout(120000) + this.timeout(240000) await servers[1].videos.upload({ attributes: { name: 'video1' } }) await servers[1].videos.upload({ attributes: { name: 'video2' } }) -- cgit v1.2.3