def main(): # Parse arguments from file docstring args = docopt.docopt(__doc__, version=__version__) URLs = args[''] cookie_file = args['--cookies'] proxy_url = args['--proxy'] username = args['--username'] password = args['--password'] quiet_mode = args['--quiet'] debug_mode = args['--debug'] use_download_archive = args['--use-download-archive'] get_comments = args['--get-comments'] ignore_existing_item = args['--ignore-existing-item'] if debug_mode: # Display log messages. root = logging.getLogger() root.setLevel(logging.DEBUG) ch = logging.StreamHandler(sys.stdout) ch.setLevel(logging.DEBUG) formatter = logging.Formatter( '\033[92m[DEBUG]\033[0m %(asctime)s - %(name)s - %(levelname)s - ' '%(message)s') ch.setFormatter(formatter) root.addHandler(ch) metadata = internetarchive.cli.argparser.get_args_dict(args['--metadata']) tu = TubeUp(verbose=not quiet_mode, output_template=args['--output'], get_comments=get_comments) try: for identifier, meta in tu.archive_urls(URLs, metadata, cookie_file, proxy_url, username, password, use_download_archive, ignore_existing_item): print('\n:: Upload Finished. Item information:') print('Title: %s' % meta['title']) print('Upload URL: https://archive.org/details/%s\n' % identifier) except Exception: print('\n\033[91m' # Start red color text 'An exception just occured, if you found this ' "exception isn't related with any of your connection problem, " 'please report this issue to ' 'https://github.com/bibanon/tubeup/issues') traceback.print_exc() print('\033[0m') # End the red color text sys.exit(1)