mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-24 15:50:32 +01:00
Fix --check-formats
when there is network error
This commit is contained in:
parent
d2a1fad968
commit
fe346461ff
@ -1726,9 +1726,13 @@ def _check_formats(formats):
|
|||||||
expand_path(paths.get('home', '').strip()),
|
expand_path(paths.get('home', '').strip()),
|
||||||
expand_path(paths.get('temp', '').strip()),
|
expand_path(paths.get('temp', '').strip()),
|
||||||
'ytdl.%s.f%s.check-format' % (random_uuidv4(), f['format_id']))
|
'ytdl.%s.f%s.check-format' % (random_uuidv4(), f['format_id']))
|
||||||
dl, _ = self.dl(temp_file, f, test=True)
|
try:
|
||||||
if os.path.exists(temp_file):
|
dl, _ = self.dl(temp_file, f, test=True)
|
||||||
os.remove(temp_file)
|
except (ExtractorError, IOError, OSError, ValueError) + network_exceptions:
|
||||||
|
dl = False
|
||||||
|
finally:
|
||||||
|
if os.path.exists(temp_file):
|
||||||
|
os.remove(temp_file)
|
||||||
if dl:
|
if dl:
|
||||||
yield f
|
yield f
|
||||||
else:
|
else:
|
||||||
@ -2395,7 +2399,7 @@ def process_info(self, info_dict):
|
|||||||
self.dl(sub_filename, sub_info.copy(), subtitle=True)
|
self.dl(sub_filename, sub_info.copy(), subtitle=True)
|
||||||
sub_info['filepath'] = sub_filename
|
sub_info['filepath'] = sub_filename
|
||||||
files_to_move[sub_filename] = sub_filename_final
|
files_to_move[sub_filename] = sub_filename_final
|
||||||
except tuple([ExtractorError, IOError, OSError, ValueError] + network_exceptions) as err:
|
except (ExtractorError, IOError, OSError, ValueError) + network_exceptions as err:
|
||||||
self.report_warning('Unable to download subtitle for "%s": %s' %
|
self.report_warning('Unable to download subtitle for "%s": %s' %
|
||||||
(sub_lang, error_to_compat_str(err)))
|
(sub_lang, error_to_compat_str(err)))
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user