sub-string)
--reject-title REGEX skip download for matching titles (regex or
caseless sub-string)
+ --max-downloads NUMBER Abort after downloading NUMBER files
### Filesystem Options:
-t, --title use title in file name
def process_info(self, info_dict):
"""Process a single dictionary returned by an InfoExtractor."""
+
+ max_downloads = int(self.params.get('max_downloads'))
+ if max_downloads is not None:
+ if self._num_downloads > max_downloads:
+ self.to_screen(u'[download] Maximum number of downloads reached. Skipping ' + info_dict['title'])
+ return
+
filename = self.prepare_filename(info_dict)
# Forced printings
dest='playlistend', metavar='NUMBER', help='playlist video to end at (default is last)', default=-1)
selection.add_option('--match-title', dest='matchtitle', metavar='REGEX',help='download only matching titles (regex or caseless sub-string)')
selection.add_option('--reject-title', dest='rejecttitle', metavar='REGEX',help='skip download for matching titles (regex or caseless sub-string)')
+ selection.add_option('--max-downloads', metavar='NUMBER', dest='max_downloads', help='Abort after downloading NUMBER files', default=None)
authentication.add_option('-u', '--username',
dest='username', metavar='USERNAME', help='account username')
'writeinfojson': opts.writeinfojson,
'matchtitle': opts.matchtitle,
'rejecttitle': opts.rejecttitle,
+ 'max_downloads': int(opts.max_downloads),
})
for extractor in extractors:
fd.add_info_extractor(extractor)
'Sören Schulze',
'Kevin Ngo',
'Ori Avtalion',
+ 'shizeeg',
)
__license__ = 'Public Domain'
def process_info(self, info_dict):
"""Process a single dictionary returned by an InfoExtractor."""
+
+ max_downloads = int(self.params.get('max_downloads'))
+ if max_downloads is not None:
+ if self._num_downloads > max_downloads:
+ self.to_screen(u'[download] Maximum number of downloads reached. Skipping ' + info_dict['title'])
+ return
+
filename = self.prepare_filename(info_dict)
# Forced printings
dest='playlistend', metavar='NUMBER', help='playlist video to end at (default is last)', default=-1)
selection.add_option('--match-title', dest='matchtitle', metavar='REGEX',help='download only matching titles (regex or caseless sub-string)')
selection.add_option('--reject-title', dest='rejecttitle', metavar='REGEX',help='skip download for matching titles (regex or caseless sub-string)')
+ selection.add_option('--max-downloads', metavar='NUMBER', dest='max_downloads', help='Abort after downloading NUMBER files', default=None)
authentication.add_option('-u', '--username',
dest='username', metavar='USERNAME', help='account username')
'writeinfojson': opts.writeinfojson,
'matchtitle': opts.matchtitle,
'rejecttitle': opts.rejecttitle,
+ 'max_downloads': int(opts.max_downloads),
})
for extractor in extractors:
fd.add_info_extractor(extractor)