diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-11-27 02:02:45 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-11-27 19:21:48 +0530 |
commit | 75689fe59bee583d2e381fa9f9416c3f53c6be53 (patch) | |
tree | 3c8f32ce4f36a361a634c25e9dab2333e1ba5725 /yt_dlp/YoutubeDL.py | |
parent | 5ce1d13eba66eae69ff42be1ddd83ae1fc1a1c59 (diff) | |
download | hypervideo-pre-75689fe59bee583d2e381fa9f9416c3f53c6be53.tar.lz hypervideo-pre-75689fe59bee583d2e381fa9f9416c3f53c6be53.tar.xz hypervideo-pre-75689fe59bee583d2e381fa9f9416c3f53c6be53.zip |
Ensure directory exists when checking formats
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r-- | yt_dlp/YoutubeDL.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 3a409b652..73834b70f 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -1740,9 +1740,10 @@ class YoutubeDL(object): 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) |