From 624bb6fe751394f853065463cafcb6723ff9212e Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Wed, 1 Mar 2023 09:45:20 +0000 Subject: [PATCH] Only calculate DASH/HLS dl speed if dl sizes are available --- devine/core/manifests/dash.py | 2 +- devine/core/manifests/hls.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devine/core/manifests/dash.py b/devine/core/manifests/dash.py index 7a104a8..407e2da 100644 --- a/devine/core/manifests/dash.py +++ b/devine/core/manifests/dash.py @@ -552,7 +552,7 @@ class DASH: if download_size: # no size == skipped dl download_sizes.append(download_size) - if time_since > 5 or finished_threads == len(segments): + if download_sizes and (time_since > 5 or finished_threads == len(segments)): data_size = sum(download_sizes) download_speed = data_size / time_since progress(downloaded=f"DASH {filesize.decimal(download_speed)}/s") diff --git a/devine/core/manifests/hls.py b/devine/core/manifests/hls.py index ed99f7d..e0e03cc 100644 --- a/devine/core/manifests/hls.py +++ b/devine/core/manifests/hls.py @@ -392,7 +392,7 @@ class HLS: if download_size: # no size == skipped dl download_sizes.append(download_size) - if time_since > 5 or finished_threads == len(master.segments): + if download_sizes and (time_since > 5 or finished_threads == len(master.segments)): data_size = sum(download_sizes) download_speed = data_size / time_since progress(downloaded=f"HLS {filesize.decimal(download_speed)}/s")