示例#1
0
    dl = DLUtils()

    # choosing store path
    dir_root = os.getcwd()
    if dir_root == "":
        print("Error : Save path not found.")
        sys.exit(1)

    # initialization
    dl = DLUtils()

    # keywords
    for input_path in args.file:
        file_path = os.path.join(dir_root, input_path)
        if not os.path.exists(file_path):
            print("Error : File not exist.\n")
            continue
        f = open(file_path, "r")

        # download images
        for index, line in enumerate(f.readlines()):
            image_url = line.strip()
            image_name = ""
            if not args.nonum:
                image_name = "{0}_{1:03d}".format(header, index+1)
            else:
                image_name = dl.get_filename(image_url)
            dl.download_image(image_url, dir_path, image_name)