[downloader/fragment] Ignore `FileNotFoundError` when downloading livestreams

when `--live-from-start` is used for YouTube and the live ends, request for the last segment prematurely ends (or 404, 403).
this is causing lack of the file and `FileNotFoundError`
lacking segment doesn't have any data, so it's safe to ignore
pull/2913/head
Lesmiscore 2022-02-26 12:34:36 +09:00
rodzic f0734e1190
commit 195c22840c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0EC2B52CF86236FF
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -137,7 +137,12 @@ class FragmentFD(FileDownloader):
if fragment_info_dict.get('filetime'):
ctx['fragment_filetime'] = fragment_info_dict.get('filetime')
ctx['fragment_filename_sanitized'] = fragment_filename
return True, self._read_fragment(ctx)
try:
return True, self._read_fragment(ctx)
except FileNotFoundError:
if not info_dict.get('is_live'):
raise
return False, None
def _read_fragment(self, ctx):
down, frag_sanitized = self.sanitize_open(ctx['fragment_filename_sanitized'], 'rb')