mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-28 22:24:34 +01:00
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
This commit is contained in:
parent
56a8fb4f77
commit
120fe5134a
1 changed files with 8 additions and 2 deletions
|
@ -1017,7 +1017,7 @@ class YoutubeDL(object):
|
||||||
path = encodeFilename(path, True).decode(preferredencoding())
|
path = encodeFilename(path, True).decode(preferredencoding())
|
||||||
return sanitize_path(path, force=self.params.get('windowsfilenames'))
|
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 """
|
""" Returns None if the file should be downloaded """
|
||||||
|
|
||||||
video_title = info_dict.get('title', info_dict.get('id', 'video'))
|
video_title = info_dict.get('title', info_dict.get('id', 'video'))
|
||||||
|
@ -1065,6 +1065,7 @@ class YoutubeDL(object):
|
||||||
reason = check_filter()
|
reason = check_filter()
|
||||||
break_opt, break_err = 'break_on_reject', RejectedVideoReached
|
break_opt, break_err = 'break_on_reject', RejectedVideoReached
|
||||||
if reason is not None:
|
if reason is not None:
|
||||||
|
if not silent:
|
||||||
self.to_screen('[download] ' + reason)
|
self.to_screen('[download] ' + reason)
|
||||||
if self.params.get(break_opt, False):
|
if self.params.get(break_opt, False):
|
||||||
raise break_err()
|
raise break_err()
|
||||||
|
@ -1351,6 +1352,11 @@ class YoutubeDL(object):
|
||||||
elif not playlistitems:
|
elif not playlistitems:
|
||||||
break
|
break
|
||||||
entries.append(entry)
|
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
|
ie_result['entries'] = entries
|
||||||
|
|
||||||
# Save playlist_index before re-ordering
|
# Save playlist_index before re-ordering
|
||||||
|
|
Loading…
Reference in a new issue