X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2F__init__.py;h=23e3c2ac29128de874c064e85523ed75c79f29a7;hb=6bf48bd866dad365845cd7dd553ef75ba5bca48c;hp=bdab38a4ef699bfe8993f89adb16807a1a9de61f;hpb=9e982f9e4eff4219f8c10df7529280b7eab16236;p=youtube-dl diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index bdab38a4e..23e3c2ac2 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -23,6 +23,7 @@ __authors__ = ( 'Dave Vasilevsky', 'Jaime Marquínez Ferrándiz', 'Jeff Crouse', + 'Osama Khalid', ) __license__ = 'Public Domain' @@ -150,9 +151,8 @@ def parseOpts(): 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) - - selection.add_option('--min-filesize', metavar='SIZE', dest='min_filesize', help="Skip files smaller than this size", default=None) - selection.add_option('--max-filesize', metavar='SIZE', dest='max_filesize', help="Skip files larger than this size", default=None) + selection.add_option('--min-filesize', metavar='SIZE', dest='min_filesize', help="Do not download any videos smaller than SIZE (e.g. 50k or 44.6m)", default=None) + selection.add_option('--max-filesize', metavar='SIZE', dest='max_filesize', help="Do not download any videos larger than SIZE (e.g. 50k or 44.6m)", default=None) authentication.add_option('-u', '--username', @@ -202,6 +202,8 @@ def parseOpts(): verbosity.add_option('--get-format', action='store_true', dest='getformat', help='simulate, quiet but print output format', default=False) + verbosity.add_option('--newline', + action='store_true', dest='progress_with_newline', help='output progress bar as new lines', default=False) verbosity.add_option('--no-progress', action='store_true', dest='noprogress', help='do not print progress bar', default=False) verbosity.add_option('--console-title', @@ -210,7 +212,6 @@ def parseOpts(): verbosity.add_option('-v', '--verbose', action='store_true', dest='verbose', help='print various debugging information', default=False) - filesystem.add_option('-t', '--title', action='store_true', dest='usetitle', help='use title in file name', default=False) filesystem.add_option('--id', @@ -290,10 +291,13 @@ def _real_main(): else: try: jar = compat_cookiejar.MozillaCookieJar(opts.cookiefile) - if os.path.isfile(opts.cookiefile) and os.access(opts.cookiefile, os.R_OK): + if os.access(opts.cookiefile, os.R_OK): jar.load() except (IOError, OSError) as err: - sys.exit(u'ERROR: unable to open cookie file') + if opts.verbose: + traceback.print_exc() + sys.stderr.write(u'ERROR: unable to open cookie file\n') + sys.exit(101) # Set user agent if opts.user_agent is not None: std_headers['User-Agent'] = opts.user_agent @@ -408,6 +412,7 @@ def _real_main(): or (opts.useid and u'%(id)s.%(ext)s') or (opts.autonumber and u'%(autonumber)s-%(id)s.%(ext)s') or u'%(id)s.%(ext)s') + # File downloader fd = FileDownloader({ 'usenetrc': opts.usenetrc, @@ -435,6 +440,7 @@ def _real_main(): 'noresizebuffer': opts.noresizebuffer, 'continuedl': opts.continue_dl, 'noprogress': opts.noprogress, + 'progress_with_newline': opts.progress_with_newline, 'playliststart': opts.playliststart, 'playlistend': opts.playlistend, 'logtostderr': opts.outtmpl == '-', @@ -445,8 +451,8 @@ def _real_main(): 'writeinfojson': opts.writeinfojson, 'writesubtitles': opts.writesubtitles, 'subtitleslang': opts.subtitleslang, - 'matchtitle': opts.matchtitle, - 'rejecttitle': opts.rejecttitle, + 'matchtitle': decodeOption(opts.matchtitle), + 'rejecttitle': decodeOption(opts.rejecttitle), 'max_downloads': opts.max_downloads, 'prefer_free_formats': opts.prefer_free_formats, 'verbose': opts.verbose,