예제 #1
0
def mk_fldr_meta(fldr_path, ftype='collection', id=None):
    _meta = fldr_path.meta
    kwargs = {**_meta}
    kwargs['id'] = id if id is not None else f'N:{ftype}:' + fldr_path.as_posix()
    meta = PathMeta(**kwargs)
    # NOTE st_mtime -> modified time of the file contents (data)
    # NOTE st_ctime -> changed time of the file status (metadata)
    # linux does not have a unified way to bet st_btime aka st_crtime which is birth time or created time
    return meta.as_xattrs(prefix='bf')
    return {'bf.id': id if id is not None else f'N:{ftype}:' + fldr_path.as_posix(),
            'bf.created': meta.created.isoformat().replace('.', ',') if meta.created is not None else None,
            'bf.updated': meta.updated.isoformat().replace('.', ',')}
예제 #2
0
def mk_fldr_meta(fldr_path, ftype='collection', id=None):
    altid = f'N:{ftype}:' + fldr_path.as_posix()
    _id = id if id is not None else altid
    _id = _id.replace(
        '/', DIVISION_SLASH
    )  # ARGH there must be a way to ensure file system safe ids :/
    _meta = fldr_path.meta
    kwargs = {**_meta}
    kwargs['id'] = _id
    meta = PathMeta(**kwargs)
    # NOTE st_mtime -> modified time of the file contents (data)
    # NOTE st_ctime -> changed time of the file status (metadata)
    # linux does not have a unified way to bet st_btime aka st_crtime which is birth time or created time
    return meta.as_xattrs(prefix='bf')
예제 #3
0
def mk_fldr_meta(fldr_path, ftype='collection', id=None):
    #import uuid
    #altid = f'N:{ftype}:{uuid.uuid4()}'  # sigh  # XXX don't do this, because we need to be able to validate without that
    #altid = f'N:{ftype}:' + fldr_path.as_posix()  # use L: to mark local instead of N: as the platform does
    altid = f'L:{ftype}:' + fldr_path.as_posix(
    )  # use L: to mark local instead of N: as the platform does
    _id = id if id is not None else altid
    _id = _id.replace(
        '/', DIVISION_SLASH
    )  # ARGH there must be a way to ensure file system safe ids :/ XXX evil
    _meta = fldr_path.meta
    kwargs = {**_meta}
    kwargs['id'] = _id
    meta = PathMeta(**kwargs)
    # NOTE st_mtime -> modified time of the file contents (data)
    # NOTE st_ctime -> changed time of the file status (metadata)
    # linux does not have a unified way to bet st_btime aka st_crtime which is birth time or created time
    return meta.as_xattrs(prefix='bf')