Completed fragments or bytes can be zero

This commit is contained in:
tcely authored and GitHub committed 2025-02-07 15:59:44 -05:00
1 parent 23abc545d2
commit d7d1f52ff3
1 file changed
+2 -2
+2 -2
View File
@@ -114,10 +114,10 @@ def yt_dlp_progress_hook(event):
percent = int(float(percent_str.rstrip('%'))) percent = int(float(percent_str.rstrip('%')))
except: except:
pass pass
if fragment_index > 0 and fragment_count > 0: if fragment_index >= 0 and fragment_count > 0:
percent = round(100 * fragment_index / fragment_count) percent = round(100 * fragment_index / fragment_count)
percent_str = f'{percent}%' percent_str = f'{percent}%'
elif downloaded_bytes > 0 and total_bytes > 0: elif downloaded_bytes >= 0 and total_bytes > 0:
percent = round(100 * downloaded_bytes / total_bytes) percent = round(100 * downloaded_bytes / total_bytes)
if percent and (status.next_progress() < percent) and (0 == percent % 5): if percent and (status.next_progress() < percent) and (0 == percent % 5):
status.download_progress = percent status.download_progress = percent