]> jfr.im git - yt-dlp.git/commitdiff
[downloader/fragment] Make single thread download work for --live-from-start (#3446)
authorLesmiscore (Naoya Ozaki) <redacted>
Sat, 16 Apr 2022 12:11:09 +0000 (21:11 +0900)
committerGitHub <redacted>
Sat, 16 Apr 2022 12:11:09 +0000 (21:11 +0900)
Authored by: Lesmiscore

yt_dlp/downloader/fragment.py

index 9012a1795b1f12eb9ad42d3c3d7cea17d6265017..2a97cfd16127d9c3ebb01e998f626d1132c01480 100644 (file)
@@ -521,8 +521,13 @@ def _download_fragment(fragment):
             for fragment in fragments:
                 if not interrupt_trigger[0]:
                     break
-                download_fragment(fragment, ctx)
-                result = append_fragment(decrypt_fragment(fragment, self._read_fragment(ctx)), fragment['frag_index'], ctx)
+                try:
+                    download_fragment(fragment, ctx)
+                    result = append_fragment(decrypt_fragment(fragment, self._read_fragment(ctx)), fragment['frag_index'], ctx)
+                except KeyboardInterrupt:
+                    if info_dict.get('is_live'):
+                        break
+                    raise
                 if not result:
                     return False