mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
Do not count unmatched videos for --max-downloads (Fixes #2211)
This commit is contained in:
parent
8c61d9a9b1
commit
fd28827864
1 changed files with 6 additions and 10 deletions
|
@ -396,10 +396,6 @@ def report_file_already_downloaded(self, file_name):
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
self.to_screen('[download] The file has already been downloaded')
|
self.to_screen('[download] The file has already been downloaded')
|
||||||
|
|
||||||
def increment_downloads(self):
|
|
||||||
"""Increment the ordinal that assigns a number to each file."""
|
|
||||||
self._num_downloads += 1
|
|
||||||
|
|
||||||
def prepare_filename(self, info_dict):
|
def prepare_filename(self, info_dict):
|
||||||
"""Generate the output filename."""
|
"""Generate the output filename."""
|
||||||
try:
|
try:
|
||||||
|
@ -773,8 +769,11 @@ def process_info(self, info_dict):
|
||||||
"""Process a single resolved IE result."""
|
"""Process a single resolved IE result."""
|
||||||
|
|
||||||
assert info_dict.get('_type', 'video') == 'video'
|
assert info_dict.get('_type', 'video') == 'video'
|
||||||
#We increment the download the download count here to match the previous behaviour.
|
|
||||||
self.increment_downloads()
|
max_downloads = self.params.get('max_downloads')
|
||||||
|
if max_downloads is not None:
|
||||||
|
if self._num_downloads >= int(max_downloads):
|
||||||
|
raise MaxDownloadsReached()
|
||||||
|
|
||||||
info_dict['fulltitle'] = info_dict['title']
|
info_dict['fulltitle'] = info_dict['title']
|
||||||
if len(info_dict['title']) > 200:
|
if len(info_dict['title']) > 200:
|
||||||
|
@ -791,10 +790,7 @@ def process_info(self, info_dict):
|
||||||
self.to_screen('[download] ' + reason)
|
self.to_screen('[download] ' + reason)
|
||||||
return
|
return
|
||||||
|
|
||||||
max_downloads = self.params.get('max_downloads')
|
self._num_downloads += 1
|
||||||
if max_downloads is not None:
|
|
||||||
if self._num_downloads > int(max_downloads):
|
|
||||||
raise MaxDownloadsReached()
|
|
||||||
|
|
||||||
filename = self.prepare_filename(info_dict)
|
filename = self.prepare_filename(info_dict)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue