X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=youtube_dl%2F__init__.py;h=54c7d7f72ed82051ad738f2039c9017ae9d58ad9;hb=e643e2c6b7d9c2f09b3d4b3d163718aadf3d5edc;hp=cbf1dd1a722570d5709b6a0dd741d33337201e07;hpb=d479e34043e95c5590d3bfa0d9dda0dc34da76c5;p=youtube-dl diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index cbf1dd1a7..54c7d7f72 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -18,10 +18,11 @@ __authors__ = ( 'Ori Avtalion', 'shizeeg', 'Filippo Valsorda', + 'Christian Albrecht', ) __license__ = 'Public Domain' -__version__ = '2012.11.27' +__version__ = '2012.11.29' UPDATE_URL = 'https://raw.github.com/rg3/youtube-dl/master/youtube-dl' UPDATE_URL_VERSION = 'https://raw.github.com/rg3/youtube-dl/master/LATEST_VERSION' @@ -126,9 +127,12 @@ def parseOpts(): opts = [] - if option._short_opts: opts.append(option._short_opts[0]) - if option._long_opts: opts.append(option._long_opts[0]) - if len(opts) > 1: opts.insert(1, ', ') + if option._short_opts: + opts.append(option._short_opts[0]) + if option._long_opts: + opts.append(option._long_opts[0]) + if len(opts) > 1: + opts.insert(1, ', ') if option.takes_value(): opts.append(' %s' % option.metavar) @@ -187,6 +191,11 @@ def parseOpts(): dest='ratelimit', metavar='LIMIT', help='download rate limit (e.g. 50k or 44.6m)') general.add_option('-R', '--retries', dest='retries', metavar='RETRIES', help='number of retries (default is %default)', default=10) + general.add_option('--buffer-size', + dest='buffersize', metavar='SIZE', help='size of download buffer (e.g. 1024 or 16k) (default is %default)', default="1024") + general.add_option('--no-resize-buffer', + action='store_true', dest='noresizebuffer', + help='do not automatically adjust the buffer size. By default, the buffer size is automatically resized from an initial value of SIZE.', default=False) general.add_option('--dump-user-agent', action='store_true', dest='dump_user_agent', help='display the current browser identification', default=False) @@ -274,7 +283,7 @@ def parseOpts(): dest='outtmpl', metavar='TEMPLATE', help='output filename template. Use %(title)s to get the title, %(uploader)s for the uploader name, %(autonumber)s to get an automatically incremented number, %(ext)s for the filename extension, %(upload_date)s for the upload date (YYYYMMDD), %(extractor)s for the provider (youtube, metacafe, etc), %(id)s for the video id and %% for a literal percent. Use - to output to stdout.') filesystem.add_option('--restrict-filenames', action='store_true', dest='restrictfilenames', - help='Avoid some characters such as "&" and spaces in filenames', default=False) + help='Restrict filenames to only ASCII characters, and avoid "&" and spaces in filenames', default=False) filesystem.add_option('-a', '--batch-file', dest='batchfile', metavar='FILE', help='file containing URLs to download (\'-\' for stdin)') filesystem.add_option('-w', '--no-overwrites', @@ -362,7 +371,7 @@ def gen_extractors(): YoukuIE(), XNXXIE(), GooglePlusIE(), - + ArteTvIE(), GenericIE() ] @@ -440,9 +449,14 @@ def _real_main(): opts.ratelimit = numeric_limit if opts.retries is not None: try: - opts.retries = long(opts.retries) + opts.retries = int(opts.retries) except (TypeError, ValueError), err: parser.error(u'invalid retry count specified') + if opts.buffersize is not None: + numeric_buffersize = FileDownloader.parse_bytes(opts.buffersize) + if numeric_buffersize is None: + parser.error(u'invalid buffer size specified') + opts.buffersize = numeric_buffersize try: opts.playliststart = int(opts.playliststart) if opts.playliststart <= 0: @@ -493,6 +507,8 @@ def _real_main(): 'ratelimit': opts.ratelimit, 'nooverwrites': opts.nooverwrites, 'retries': opts.retries, + 'buffersize': opts.buffersize, + 'noresizebuffer': opts.noresizebuffer, 'continuedl': opts.continue_dl, 'noprogress': opts.noprogress, 'playliststart': opts.playliststart, @@ -532,7 +548,7 @@ def _real_main(): parser.error(u'you must provide at least one URL') else: sys.exit() - + try: retcode = fd.download(all_urls) except MaxDownloadsReached: