mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 14:14:54 +01:00
Introduce --keep-fragments
This commit is contained in:
parent
d3f0687cf7
commit
0eee52f34b
|
@ -343,6 +343,7 @@ def parse_retries(retries):
|
||||||
'retries': opts.retries,
|
'retries': opts.retries,
|
||||||
'fragment_retries': opts.fragment_retries,
|
'fragment_retries': opts.fragment_retries,
|
||||||
'skip_unavailable_fragments': opts.skip_unavailable_fragments,
|
'skip_unavailable_fragments': opts.skip_unavailable_fragments,
|
||||||
|
'keep_fragments': opts.keep_fragments,
|
||||||
'buffersize': opts.buffersize,
|
'buffersize': opts.buffersize,
|
||||||
'noresizebuffer': opts.noresizebuffer,
|
'noresizebuffer': opts.noresizebuffer,
|
||||||
'continuedl': opts.continue_dl,
|
'continuedl': opts.continue_dl,
|
||||||
|
|
|
@ -29,6 +29,8 @@ class FragmentFD(FileDownloader):
|
||||||
and hlsnative only)
|
and hlsnative only)
|
||||||
skip_unavailable_fragments:
|
skip_unavailable_fragments:
|
||||||
Skip unavailable fragments (DASH and hlsnative only)
|
Skip unavailable fragments (DASH and hlsnative only)
|
||||||
|
keep_fragments: Keep downloaded fragments on disk after downloading is
|
||||||
|
finished
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def report_retry_fragment(self, err, frag_index, count, retries):
|
def report_retry_fragment(self, err, frag_index, count, retries):
|
||||||
|
@ -81,6 +83,7 @@ def _append_fragment(self, ctx, frag_content):
|
||||||
finally:
|
finally:
|
||||||
if not (ctx.get('live') or ctx['tmpfilename'] == '-'):
|
if not (ctx.get('live') or ctx['tmpfilename'] == '-'):
|
||||||
self._write_ytdl_file(ctx)
|
self._write_ytdl_file(ctx)
|
||||||
|
if not self.params.get('keep_fragments', False):
|
||||||
os.remove(ctx['fragment_filename_sanitized'])
|
os.remove(ctx['fragment_filename_sanitized'])
|
||||||
del ctx['fragment_filename_sanitized']
|
del ctx['fragment_filename_sanitized']
|
||||||
|
|
||||||
|
|
|
@ -468,6 +468,10 @@ def _scrub_eq(o):
|
||||||
'--abort-on-unavailable-fragment',
|
'--abort-on-unavailable-fragment',
|
||||||
action='store_false', dest='skip_unavailable_fragments',
|
action='store_false', dest='skip_unavailable_fragments',
|
||||||
help='Abort downloading when some fragment is not available')
|
help='Abort downloading when some fragment is not available')
|
||||||
|
downloader.add_option(
|
||||||
|
'--keep-fragments',
|
||||||
|
action='store_true', dest='keep_fragments', default=False,
|
||||||
|
help='Keep downloaded fragments on disk after downloading is finished; fragments are erased by default')
|
||||||
downloader.add_option(
|
downloader.add_option(
|
||||||
'--buffer-size',
|
'--buffer-size',
|
||||||
dest='buffersize', metavar='SIZE', default='1024',
|
dest='buffersize', metavar='SIZE', default='1024',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user