A feature-rich command-line audio/video downloader
[downloader/ism] Prevent writing the header again when resuming an interrupted download
Felix Sd4553567d2f3
diff --git a/yt_dlp/downloader/ism.py b/yt_dlp/downloader/ism.pyindex 1ca666b4a1..b3e22793b3 100644--- a/yt_dlp/downloader/ism.py+++ b/yt_dlp/downloader/ism.py@@ -221,10 +221,13 @@ class IsmFD(FragmentFD):self._prepare_and_start_frag_download(ctx)+ extra_state = ctx.setdefault('extra_state', {+ 'ism_track_written': False,+ })+fragment_retries = self.params.get('fragment_retries', 0)skip_unavailable_fragments = self.params.get('skip_unavailable_fragments', True)- track_written = Falsefrag_index = 0for i, segment in enumerate(segments):frag_index += 1@@ -236,11 +239,11 @@ class IsmFD(FragmentFD):success, frag_content = self._download_fragment(ctx, segment['url'], info_dict)if not success:return False- if not track_written:+ if not extra_state['ism_track_written']:tfhd_data = extract_box_data(frag_content, [b'moof', b'traf', b'tfhd'])info_dict['_download_params']['track_id'] = u32.unpack(tfhd_data[4:8])[0]write_piff_header(ctx['dest_stream'], info_dict['_download_params'])- track_written = True+ extra_state['ism_track_written'] = Trueself._append_fragment(ctx, frag_content)breakexcept compat_urllib_error.HTTPError as err: