[dash] Show fragment count with `--live-from-start` (#3493)

Authored by: flashdagger
This commit is contained in:
MMM 2022-06-07 14:44:08 +02:00 committed by GitHub
parent 65141660ab
commit 36195c4461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View File

@ -73,6 +73,7 @@ class DashSegmentsFD(FragmentFD):
yield { yield {
'frag_index': frag_index, 'frag_index': frag_index,
'fragment_count': fragment.get('fragment_count'),
'index': i, 'index': i,
'url': fragment_url, 'url': fragment_url,
} }

View File

@ -242,6 +242,9 @@ class FragmentFD(FileDownloader):
if s['status'] not in ('downloading', 'finished'): if s['status'] not in ('downloading', 'finished'):
return 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: if ctx_id is not None and s.get('ctx_id') != ctx_id:
return return
@ -450,6 +453,7 @@ class FragmentFD(FileDownloader):
fatal, count = is_fatal(fragment.get('index') or (frag_index - 1)), 0 fatal, count = is_fatal(fragment.get('index') or (frag_index - 1)), 0
while count <= fragment_retries: while count <= fragment_retries:
try: try:
ctx['fragment_count'] = fragment.get('fragment_count')
if self._download_fragment(ctx, fragment['url'], info_dict, headers): if self._download_fragment(ctx, fragment['url'], info_dict, headers):
break break
return return

View File

@ -2407,6 +2407,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
last_segment_url = urljoin(fragment_base_url, 'sq/%d' % idx) last_segment_url = urljoin(fragment_base_url, 'sq/%d' % idx)
yield { yield {
'url': last_segment_url, 'url': last_segment_url,
'fragment_count': last_seq,
} }
if known_idx == last_seq: if known_idx == last_seq:
no_fragment_score += 5 no_fragment_score += 5