1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-04 13:14:57 -04:00

Native concurrent downloading of fragments (#166)

* Option `--concurrent-fragments` (`-N`) to set the number of threads

Related: #165

Known issues:
* When receiving Ctrl+C, the process will exit only after finishing the currently downloading fragments
* The download progress shows the speed of only one thread

Authored by shirt-dev
This commit is contained in:
shirt
2021-03-12 23:46:58 -05:00
committed by GitHub
parent 0a473f2f0f
commit 4cf1e5d2f9
7 changed files with 250 additions and 104 deletions

View File

@@ -180,6 +180,8 @@ def _real_main(argv=None):
if opts.overwrites:
# --yes-overwrites implies --no-continue
opts.continue_dl = False
if opts.concurrent_fragment_downloads <= 0:
raise ValueError('Concurrent fragments must be positive')
def parse_retries(retries, name=''):
if retries in ('inf', 'infinite'):
@@ -463,6 +465,7 @@ def _real_main(argv=None):
'extractor_retries': opts.extractor_retries,
'skip_unavailable_fragments': opts.skip_unavailable_fragments,
'keep_fragments': opts.keep_fragments,
'concurrent_fragment_downloads': opts.concurrent_fragment_downloads,
'buffersize': opts.buffersize,
'noresizebuffer': opts.noresizebuffer,
'http_chunk_size': opts.http_chunk_size,