A feature-rich command-line audio/video downloader
[dash] Show fragment count with `--live-from-start` (#3493)
MMM36195c446170
diff --git a/yt_dlp/downloader/dash.py b/yt_dlp/downloader/dash.pyindex d0a0b28934..a6da26f09d 100644--- a/yt_dlp/downloader/dash.py+++ b/yt_dlp/downloader/dash.py@@ -73,6 +73,7 @@ class DashSegmentsFD(FragmentFD):yield {'frag_index': frag_index,+ 'fragment_count': fragment.get('fragment_count'),'index': i,'url': fragment_url,}diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.pyindex d94cb49569..79161b8092 100644--- a/yt_dlp/downloader/fragment.py+++ b/yt_dlp/downloader/fragment.py@@ -242,6 +242,9 @@ class FragmentFD(FileDownloader):if s['status'] not in ('downloading', 'finished'):return+ if not total_frags and ctx.get('fragment_count'):+ state['fragment_count'] = ctx['fragment_count']+if ctx_id is not None and s.get('ctx_id') != ctx_id:return@@ -450,6 +453,7 @@ class FragmentFD(FileDownloader):fatal, count = is_fatal(fragment.get('index') or (frag_index - 1)), 0while count <= fragment_retries:try:+ ctx['fragment_count'] = fragment.get('fragment_count')if self._download_fragment(ctx, fragment['url'], info_dict, headers):breakreturndiff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.pyindex 113b9aa07a..d44f16bc0b 100644--- a/yt_dlp/extractor/youtube.py+++ b/yt_dlp/extractor/youtube.py@@ -2407,6 +2407,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):last_segment_url = urljoin(fragment_base_url, 'sq/%d' % idx)yield {'url': last_segment_url,+ 'fragment_count': last_seq,}if known_idx == last_seq:no_fragment_score += 5