mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-26 02:14:32 +01:00
Fix for '--max-downloads' to stop immediately when reaching the limit.
Currently, the specifying a limit with `--max-downloads` doesn't cause **youtube-dl** to stop right after it has successfully downloaded that number of files. Instead, it keeps iterating the playlist until another candidate file is found to download, only to then discovers that the limit was previously met. This unnecessary activity can actually take quite a while when a large playlist is already mostly downloaded. This fix adds an additional tail-check on the `_num_downloads` condition so that it terminates immediately after finishing the last eligible file.
This commit is contained in:
parent
b55715934b
commit
eccee557b1
@ -2002,6 +2002,9 @@ class YoutubeDL(object):
|
||||
self.report_error('postprocessing: %s' % str(err))
|
||||
return
|
||||
self.record_download_archive(info_dict)
|
||||
max_downloads = self.params.get('max_downloads')
|
||||
if max_downloads is not None and self._num_downloads >= int(max_downloads):
|
||||
raise MaxDownloadsReached()
|
||||
|
||||
def download(self, url_list):
|
||||
"""Download a given list of URLs."""
|
||||
|
Loading…
Reference in New Issue
Block a user