From: Philipp Hagemeister Date: Sun, 6 Oct 2013 14:30:26 +0000 (+0200) Subject: Merge branch 'download-archive' X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=b24f347190b02e519dae9e60e1dff2c56ecdd92f;p=youtube-dl Merge branch 'download-archive' Conflicts: youtube_dl/YoutubeDL.py youtube_dl/__init__.py --- b24f347190b02e519dae9e60e1dff2c56ecdd92f diff --cc youtube_dl/YoutubeDL.py index 9ada01bcc,856e9ac92..073a3837c --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@@ -84,8 -85,9 +85,11 @@@ class YoutubeDL(object) cachedir: Location of the cache files in the filesystem. None to disable filesystem cache. noplaylist: Download single video instead of a playlist if in doubt. + age_limit: An integer representing the user's age in years. + Unsuitable videos for the given age are skipped. + downloadarchive: File name of a file where all downloads are recorded. + Videos already present in the file are not downloaded + again. The following parameters are not used by YoutubeDL itself, they are used by the FileDownloader: @@@ -311,10 -313,9 +315,13 @@@ dateRange = self.params.get('daterange', DateRange()) if date not in dateRange: return u'[download] %s upload date is not in range %s' % (date_from_str(date).isoformat(), dateRange) + age_limit = self.params.get('age_limit') + if age_limit is not None: + if age_limit < info_dict.get('age_limit', 0): + return u'Skipping "' + title + '" because it is age restricted' + if self.in_download_archive(info_dict): + return (u'%(title)s has already been recorded in archive' + % info_dict) return None def extract_info(self, url, download=True, ie_key=None, extra_info={}): diff --cc youtube_dl/__init__.py index 7a399273a,a680d7c55..ba5206387 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@@ -188,9 -188,9 +188,12 @@@ def parseOpts(overrideArguments=None) selection.add_option('--datebefore', metavar='DATE', dest='datebefore', help='download only videos uploaded before this date', default=None) selection.add_option('--dateafter', metavar='DATE', dest='dateafter', help='download only videos uploaded after this date', default=None) selection.add_option('--no-playlist', action='store_true', dest='noplaylist', help='download only the currently playing video', default=False) + selection.add_option('--age-limit', metavar='YEARS', dest='age_limit', + help='download only videos suitable for the given age', + default=None, type=int) + selection.add_option('--download-archive', metavar='FILE', + dest='download_archive', + help='Download only videos not present in the archive file. Record all downloaded videos in it.') authentication.add_option('-u', '--username', @@@ -634,7 -634,7 +637,8 @@@ def _real_main(argv=None) 'daterange': date, 'cachedir': opts.cachedir, 'youtube_print_sig_code': opts.youtube_print_sig_code, + 'age_limit': opts.age_limit, + 'download_archive': opts.download_archive, }) if opts.verbose: