INNER CODE UNIT · Python
get_image_meta
yurijmikhalevich/rclip · rclip/main.py:33
def get_image_meta(entry: os.DirEntry[str]) -> ImageMeta:
stat = entry.stat()
return ImageMeta(modified_at=stat.st_mtime, size=stat.st_size)
def is_image_meta_equal(image: db.ImageState, meta: ImageMeta) -> bool:
return meta["modified_at"] == image["modified_at"] and meta["size"] == image["size"]
def _too_large_message(path: str, pixels: int, limit: int) -> str:
size = f" ({pixels / 1_000_000:.0f} MP)" if pixels else ""
return (
f"skipping {path}: it is too large to process{size};"
f" the limit is {limit / 1_000_000:.0f} MP."
' Raise or disable it with "--max-image-megapixels" if you want to index this image'
)