diff options
author | bobzel <zzzman@gmail.com> | 2022-09-23 19:39:27 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-09-23 19:39:27 -0400 |
commit | 08ac1b5b340f1a316b5debfdfa9912437c7c8a46 (patch) | |
tree | 54482d05b6a3333eee2e39db9dc96b06bea25968 | |
parent | ddc7c4019eff459be9e81583aa956720c687818d (diff) |
added max file size to youtube uploads of 100M
-rw-r--r-- | src/server/DashUploadUtils.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/server/DashUploadUtils.ts b/src/server/DashUploadUtils.ts index 45e88d8cc..5aa22e432 100644 --- a/src/server/DashUploadUtils.ts +++ b/src/server/DashUploadUtils.ts @@ -137,16 +137,16 @@ export namespace DashUploadUtils { res(resolveExistingFile(name, finalPath, Directory.videos, 'video/mp4', duration, undefined)); }); } else { - const ytdlp = spawn(`yt-dlp`, ['-o', path, videoId, '-f', 'mp4']); + uploadProgress.set(videoId, 'starting download'); + const ytdlp = spawn(`yt-dlp`, ['-o', path, `https://www.youtube.com/watch?v=${videoId}`, '--max-filesize', '100M', '-f', 'mp4']); - ytdlp.stdout.on('data', (data: any) => uploadProgress.set(videoId, data.toString())); + ytdlp.stdout.on('data', (data: any) => !uploadProgress.get(videoId)?.includes('Aborting.') && uploadProgress.set(videoId, data.toString())); let errors = ''; ytdlp.stderr.on('data', (data: any) => (errors = data.toString())); ytdlp.on('exit', function (code: any) { - if (code) { - console.log(`error: Error: ${NoEmitOnErrorsPlugin}`); + if (code || uploadProgress.get(videoId)?.includes('Aborting.')) { res({ source: { size: 0, @@ -155,7 +155,7 @@ export namespace DashUploadUtils { type: '', toJSON: () => ({ name, path }), }, - result: { name: 'failed youtube query', message: `Could not upload video. ${errors}` }, + result: { name: 'failed youtube query', message: `Could not archive video. ${code ? errors : uploadProgress.get(videoId)}` }, }); } else { uploadProgress.set(videoId, 'computing duration'); |