|
|
|
|
@ -584,6 +584,14 @@ describe('Downloader', function() {
|
|
|
|
|
assert(returned_download);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('Respect max concurrent downloads sentinel -1', function() {
|
|
|
|
|
assert.strictEqual(downloader_api.hasReachedConcurrentDownloadLimit(-1, 0), false);
|
|
|
|
|
assert.strictEqual(downloader_api.hasReachedConcurrentDownloadLimit('-1', 5), false);
|
|
|
|
|
assert.strictEqual(downloader_api.hasReachedConcurrentDownloadLimit(0, 0), true);
|
|
|
|
|
assert.strictEqual(downloader_api.hasReachedConcurrentDownloadLimit(1, 0), false);
|
|
|
|
|
assert.strictEqual(downloader_api.hasReachedConcurrentDownloadLimit(1, 1), true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('Pause file', async function() {
|
|
|
|
|
const returned_download = await downloader_api.createDownload(url, 'video', options);
|
|
|
|
|
await downloader_api.pauseDownload(returned_download['uid']);
|
|
|
|
|
@ -1142,4 +1150,4 @@ const generateEmptyVideoFile = async (file_path) => {
|
|
|
|
|
const generateEmptyAudioFile = async (file_path) => {
|
|
|
|
|
if (fs.existsSync(file_path)) fs.unlinkSync(file_path);
|
|
|
|
|
return await exec(`ffmpeg -f lavfi -i anullsrc=r=44100:cl=mono -t 1 -q:a 9 -acodec libmp3lame ${file_path}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|