Prefer fragment count calculation
When the first fragment is downloaded, the percent is calculated as `100`, because the bytes and total are from the fragment, which prevents additional logging.
This commit is contained in:
1 parent
ee9849a1aa
commit
90b892fd85
1 file changed
+2
-2
@@ -114,10 +114,10 @@ def yt_dlp_progress_hook(event):
|
||||
percent = int(float(percent_str.rstrip('%')))
|
||||
except:
|
||||
pass
|
||||
if downloaded_bytes > 0 and total_bytes > 0:
|
||||
percent = round(100 * downloaded_bytes / total_bytes)
|
||||
if fragment_index > 0 and fragment_count > 0:
|
||||
percent = round(100 * fragment_index / fragment_count)
|
||||
elif downloaded_bytes > 0 and total_bytes > 0:
|
||||
percent = round(100 * downloaded_bytes / total_bytes)
|
||||
if percent and (status.next_progress() < percent) and (0 == percent % 5):
|
||||
status.download_progress = percent
|
||||
log.info(f'[youtube-dl] downloading: {filename} - {percent_str} '
|
||||
|
||||
Reference in new issue
Block a user