1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-17 00:22:34 +01:00

Ensure directory exists when checking formats

This commit is contained in:
pukkandan 2021-11-27 02:02:45 +05:30
parent 5ce1d13eba
commit 75689fe59b
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698

View File

@ -1740,9 +1740,10 @@ def _filter(f):
def _check_formats(self, formats):
for f in formats:
self.to_screen('[info] Testing format %s' % f['format_id'])
temp_file = tempfile.NamedTemporaryFile(
suffix='.tmp', delete=False,
dir=self.get_output_path('temp') or None)
path = self.get_output_path('temp')
if not self._ensure_dir_exists(f'{path}/'):
continue
temp_file = tempfile.NamedTemporaryFile(suffix='.tmp', delete=False, dir=path or None)
temp_file.close()
try:
success, _ = self.dl(temp_file.name, f, test=True)