naturtag.storage.session module¶
- class naturtag.storage.session.ImageSession(*args, cache_path=PosixPath('/home/docs/.local/share/Naturtag/images.db'), **kwargs)¶
Bases:
ClientSession
- cache_size()¶
Get the total cache size in bytes, and the number of cached files
- Return type:
str
- get_image(photo, url=None, size=None)¶
Get an image from the cache, if it exists; otherwise, download and cache a new one
- Return type:
bytes
- get_pixmap(path=None, photo=None, url=None, size=None)¶
Fetch a pixmap from either a local path or remote URL. This does not render the image, so it is safe to run from any thread.
- Return type:
QPixmap
- naturtag.storage.session.get_url_hash(url)¶
Generate a hash to use as a cache key from an image URL, appended with the file extension
- Parameters:
source – File path or URI for image source
- Return type:
str