diff options
author | Philipp Hagemeister <phihag@phihag.de> | 2014-01-23 18:56:36 +0100 |
---|---|---|
committer | Philipp Hagemeister <phihag@phihag.de> | 2014-01-23 19:04:22 +0100 |
commit | fd28827864f94aee1cb4103179b6c4965f0b6641 (patch) | |
tree | 8ed6d297e38ca8fa67405788bf2d70145b06df17 /youtube_dl/YoutubeDL.py | |
parent | 8c61d9a9b11cd768a7f93da00daa5ce6aec7d92c (diff) |
Do not count unmatched videos for --max-downloads (Fixes #2211)
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r-- | youtube_dl/YoutubeDL.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index f30bc090a..f202ba4f0 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -396,10 +396,6 @@ class YoutubeDL(object): except UnicodeEncodeError: 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): """Generate the output filename.""" try: @@ -773,8 +769,11 @@ class YoutubeDL(object): """Process a single resolved IE result.""" 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'] if len(info_dict['title']) > 200: @@ -791,10 +790,7 @@ class YoutubeDL(object): self.to_screen('[download] ' + reason) return - max_downloads = self.params.get('max_downloads') - if max_downloads is not None: - if self._num_downloads > int(max_downloads): - raise MaxDownloadsReached() + self._num_downloads += 1 filename = self.prepare_filename(info_dict) |