diff options
author | Chocobozzz <me@florianbigard.com> | 2021-10-22 14:25:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-10-22 14:25:32 +0200 |
commit | 5480933b7f088bf099b25fb467faace814f0da58 (patch) | |
tree | 4a813030959bb1b65ab17493f5f694db99883fc0 /server/helpers/youtube-dl/youtube-dl-wrapper.ts | |
parent | ab4001aade0891b70e456a215ced0f825c57fde8 (diff) | |
download | PeerTube-5480933b7f088bf099b25fb467faace814f0da58.tar.gz PeerTube-5480933b7f088bf099b25fb467faace814f0da58.tar.zst PeerTube-5480933b7f088bf099b25fb467faace814f0da58.zip |
Add peertube short link import test
Diffstat (limited to 'server/helpers/youtube-dl/youtube-dl-wrapper.ts')
-rw-r--r-- | server/helpers/youtube-dl/youtube-dl-wrapper.ts | 4 |
1 files changed, 2 insertions, 2 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 | ||