aboutsummaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/downloader/fragment.py
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2017-04-24 03:09:08 +0700
committerSergey M․ <[email protected]>2017-04-24 03:09:08 +0700
commit0eee52f34bfa55ba9d4ebfc4b4ba508c989f05b0 (patch)
tree6a003f95e86e4c9e46f47dca3e07861ed784d73b /youtube_dl/downloader/fragment.py
parentd3f0687cf7b049b976420056e02c26b5d96adeed (diff)
downloadyoutube-dl-0eee52f34bfa55ba9d4ebfc4b4ba508c989f05b0.tar.gz
youtube-dl-0eee52f34bfa55ba9d4ebfc4b4ba508c989f05b0.zip
Introduce --keep-fragments
Diffstat (limited to 'youtube_dl/downloader/fragment.py')
-rw-r--r--youtube_dl/downloader/fragment.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/youtube_dl/downloader/fragment.py b/youtube_dl/downloader/fragment.py
index 62de0a75b..bcff94cbe 100644
--- a/youtube_dl/downloader/fragment.py
+++ b/youtube_dl/downloader/fragment.py
@@ -29,6 +29,8 @@ class FragmentFD(FileDownloader):
and hlsnative only)
skip_unavailable_fragments:
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):
@@ -81,7 +83,8 @@ class FragmentFD(FileDownloader):
finally:
if not (ctx.get('live') or ctx['tmpfilename'] == '-'):
self._write_ytdl_file(ctx)
- os.remove(ctx['fragment_filename_sanitized'])
+ if not self.params.get('keep_fragments', False):
+ os.remove(ctx['fragment_filename_sanitized'])
del ctx['fragment_filename_sanitized']
def _prepare_frag_download(self, ctx):