adesse

Signed testimonials for certifications.
Log | Files | Refs

commit ea526a5226bbc57d32a51d36a6432e645c42a394
parent 3eec507299ec75a8549a31a9c0edb3d1aea48b06
Author: lash <dev@holbrook.no>
Date:   Mon,  7 Sep 2026 19:04:34 -0600

Add file adding tool, WIP

Diffstat:
Aadesse/runnable/file.py | 45+++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+), 0 deletions(-)

diff --git a/adesse/runnable/file.py b/adesse/runnable/file.py @@ -0,0 +1,45 @@ +import argparse +import logging +import uuid + +from adesse import Attachment +from adesse.store import FsStore +from adesse.util.xmp import attachment_from_xmp + + +logging.basicConfig(level=logging.WARNING) +logg = logging.getLogger() + + +def baseopener(v): + f = open(v, 'rb') + return f + + + +def main(): + argp = argparse.ArgumentParser() + argp.add_argument('-d', type=str, default='.', help='output directory base') + argp.add_argument('-v', action='store_true', help='debug output') + argp.add_argument('-u', type=str, help='uuid ns for generating deterministic uuid5 values') + argp.add_argument('-s', type=str, help='subject category to add resource to') + argp.add_argument('--xmp', type=str, help='path to xmp file to read metadata from') + argp.add_argument('filepath', type=str, help='file to attach') + args = argp.parse_args() + + if args.v: + logg.setLevel(logging.DEBUG) + + uu = None + if args.u != None: + uu = uuid.UUID(args.u) + o = attachment_from_xmp(args.xmp, resource_file=args.filepath, subject=args.s, opener=baseopener) + o.srcadd(args.filepath) + store = FsStore(args.d, seed=uu) + store.register_sha256() + store.register_sha512() + store.put(o) + + +if __name__ == '__main__': + main()