Ejemplo n.º 1
0
    parser.add_argument("--no-processing",
                        action='store_true',
                        help="Do not process the aggregated files",
                        default=False)
    parser.add_argument(
        '--sample',
        nargs='?',
        const=10,
        type=int,
        help="Include a sample only from each book. Default size 10.")
    args = vars(parser.parse_args())
    if args['list_books']:
        print_books_list()
        exit(0)
    if args["books"] is not None and args["books"].lower() != "all":
        args["books"] = [s.strip() for s in args["books"].split(",")]
        for b in args["books"]:  # Check if books exist
            if b not in dict_to_long:
                print(
                    "Unknown Book: %s, please use -l to list available books."
                    % b)
                exit(-1)
    else:
        args["books"] = list(dict_to_long.keys())
    print_banner()
    aggregated_files = []
    aggregate(args["books"], args["sample"])
    args['no_processing'] and exit(0)
    with Timer('process(aggregated_files)'):
        process(aggregated_files)