aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/downloader/dash.py
diff options
context:
space:
mode:
authordirkf <fieldhouse@gmx.net>2023-03-11 12:17:00 +0000
committerdirkf <fieldhouse@gmx.net>2023-03-14 16:23:20 +0000
commitbaa6c5e95cb307e7d716645780ff8aef22de6aca (patch)
tree419f4f2cd94ac6f2b3fa8fb60483b8bb933a658c /youtube_dl/downloader/dash.py
parent5c985d4f81a43ada75dafb23233e7fe39913907a (diff)
downloadyoutube-dl-baa6c5e95cb307e7d716645780ff8aef22de6aca.tar.xz
[FragmentFD] Respect `--no-continue`
* discard partial fragment on `--no-continue` * continue with correct progress display otherwise Resolves #21467
Diffstat (limited to 'youtube_dl/downloader/dash.py')
-rw-r--r--youtube_dl/downloader/dash.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/youtube_dl/downloader/dash.py b/youtube_dl/downloader/dash.py
index c6d674bc6..cc30485f8 100644
--- a/youtube_dl/downloader/dash.py
+++ b/youtube_dl/downloader/dash.py
@@ -38,8 +38,7 @@ class DashSegmentsFD(FragmentFD):
# In DASH, the first segment contains necessary headers to
# generate a valid MP4 file, so always abort for the first segment
fatal = i == 0 or not skip_unavailable_fragments
- count = 0
- while count <= fragment_retries:
+ for count in range(fragment_retries + 1):
try:
fragment_url = fragment.get('url')
if not fragment_url:
@@ -57,9 +56,8 @@ class DashSegmentsFD(FragmentFD):
# is usually enough) thus allowing to download the whole file successfully.
# To be future-proof we will retry all fragments that fail with any
# HTTP error.
- count += 1
- if count <= fragment_retries:
- self.report_retry_fragment(err, frag_index, count, fragment_retries)
+ if count < fragment_retries:
+ self.report_retry_fragment(err, frag_index, count + 1, fragment_retries)
except DownloadError:
# Don't retry fragment if error occurred during HTTP downloading
# itself since it has own retry settings
@@ -68,7 +66,7 @@ class DashSegmentsFD(FragmentFD):
break
raise
- if count > fragment_retries:
+ if count >= fragment_retries:
if not fatal:
self.report_skip_fragment(frag_index)
continue