aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-05-28 22:08:01 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-05-29 02:12:09 +0530
commit120fe5134afe5ff0391bbae30a1d179df4dc9a39 (patch)
tree14c7309d7bfc160f71837c8ebd2827884633fc3e
parent56a8fb4f778d26dc4dc2d1787a3d9dcf7aead84e (diff)
downloadhypervideo-pre-120fe5134afe5ff0391bbae30a1d179df4dc9a39.tar.lz
hypervideo-pre-120fe5134afe5ff0391bbae30a1d179df4dc9a39.tar.xz
hypervideo-pre-120fe5134afe5ff0391bbae30a1d179df4dc9a39.zip
Pre-check archive and filters during playlist extraction
This makes `--break-on-existing` much faster. It also helps `--break-on-reject` if the playlist extractor can extract the relevant fields
-rw-r--r--yt_dlp/YoutubeDL.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index a5892a5a7..80f54fd3e 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -1017,7 +1017,7 @@ class YoutubeDL(object):
path = encodeFilename(path, True).decode(preferredencoding())
return sanitize_path(path, force=self.params.get('windowsfilenames'))
- def _match_entry(self, info_dict, incomplete=False):
+ def _match_entry(self, info_dict, incomplete=False, silent=False):
""" Returns None if the file should be downloaded """
video_title = info_dict.get('title', info_dict.get('id', 'video'))
@@ -1065,7 +1065,8 @@ class YoutubeDL(object):
reason = check_filter()
break_opt, break_err = 'break_on_reject', RejectedVideoReached
if reason is not None:
- self.to_screen('[download] ' + reason)
+ if not silent:
+ self.to_screen('[download] ' + reason)
if self.params.get(break_opt, False):
raise break_err()
return reason
@@ -1351,6 +1352,11 @@ class YoutubeDL(object):
elif not playlistitems:
break
entries.append(entry)
+ try:
+ if entry is not None:
+ self._match_entry(entry, incomplete=True, silent=True)
+ except (ExistingVideoReached, RejectedVideoReached):
+ break
ie_result['entries'] = entries
# Save playlist_index before re-ordering