num_paths = len(args.path) show_warnings = not args.quiet and not args.very_quiet for path in args.path: num += 1 path_type = ocfl.find_path_type(path) if path_type == 'object': log.info("Validating OCFL Object at %s", path) obj = ocfl.Object(lax_digests=args.lax_digests) if obj.validate(path, show_warnings=show_warnings, show_errors=not args.very_quiet, check_digests=not args.no_check_digests): num_good += 1 elif path_type == 'root': log.info("Validating OCFL Storage Root at %s", path) store = ocfl.Store(root=path, lax_digests=args.lax_digests) if store.validate(show_warnings=show_warnings, show_errors=not args.very_quiet, check_digests=not args.no_check_digests): num_good += 1 elif path_type == 'file': log.info("Validating separate OCFL Inventory at %s", path) obj = ocfl.Object(lax_digests=args.lax_digests) if obj.validate_inventory(path, show_warnings=show_warnings, show_errors=not args.very_quiet): num_good += 1 else: log.error("Bad path %s (%s)", path, path_type) if num_paths > 1: log.info(" [%d / %d paths validated, %d / %d VALID]\n", num, num_paths,
help='source path of object or version') parser.add_argument('--digest', default='sha512', help='digest type to use') parser.add_argument('--fixity', action='append', help='add fixity type to add') # Version metadata and object settings ocfl.add_version_metadata_args(parser) ocfl.add_object_args(parser) ocfl.add_shared_args(parser) args = parser.parse_args() ocfl.check_shared_args(args) logging.basicConfig(level=logging.INFO if args.verbose else logging.WARN) try: store = ocfl.Store(root=args.root, disposition=args.disposition, lax_digests=args.lax_digests) if args.init: store.initialize() elif args.list: store.list() elif args.validate: store.validate(show_warnings=not args.quiet) elif args.add: if not args.src: raise ocfl.StoreException("Must specify object path with --src") store.add(object_path=args.src) elif args.purge: logging.error("purge not implemented") elif args.show_object or args.validate_object: if not args.id:
parser.add_argument('--fixity', action='append', help='add fixity type to add') # Version metadata and object settings ocfl.add_version_metadata_args(parser) ocfl.add_object_args(parser) parser.add_argument('--verbose', '-v', action='store_true', help="be more verbose") args = parser.parse_args() logging.basicConfig(level=logging.INFO if args.verbose else logging.WARN) try: store = ocfl.Store(root=args.root, disposition=args.disposition) if args.init: store.initialize() elif args.list: store.list() elif args.add: if not args.src: raise ocfl.StoreException("Must specify object path with --src") store.add(object_path=args.src) elif args.purge: logging.error("purge not implemented") elif args.create or args.build or args.show or args.validate: if not args.id: raise ocfl.StoreException("Must specify id to act on an object in the store") objdir = store.object_path(args.id) obj = ocfl.Object(identifier=args.id,