class documentation

The database engine to back gallery interactions for scans.

Method unique_scan_name Get the next unique scan name starting with the given name.
Class Variable card_type Undocumented
Method _card_actions Create the action buttons for this entry's card if it can be stitched.
Method _card_messages Create the alerts at the bottom of the Scan cards.
Method _create_viewer_data Create the viewer data for the GalleryEntryModel.
Method _delete_endpoint Return the endpoint for deleting an entry (relative to the base URL).
Method _download_buttons Create the download buttons for the scan.
Method _generate_entry Create a GalleryEntry for an item based on the data on disk.
Method _hash Create a unique hash for an item.
Method _list_all_items_on_file_system List all the items on this file system.

Inherited from OFMGalleryDBEngine:

Method __init__ Initialise the database engine.
Method add Add an item to the gallery database.
Method delete Delete an item from the gallery database.
Method dispose Dispose of the active connections for this database engine.
Method entry_to_base_model Convert GalleryEntry to GalleryEntryModel.
Method fullpath_to_normpath Convert the abs native path to the relative posix path for the database.
Method get Get a single item from the gallery database.
Method get_all_entries Get a list of all Gallery Entries.
Method get_all_entries_as_base_model Get a list of entries as a base model for the API.
Method get_all_paths Get a list of the paths for all gallery items.
Method normpath_to_fullpath Convert the relative posix path from the database to the abs native path.
Method rebuild Rebuild a single gallery entry as it has changed on disk.
Method session Yield a database session. Commit on completion, rollback on error.
Method sync_db_with_file_system Sync the database with the file system.
Class Variable gallery_info_model Undocumented
Method _mounted_path Return the mount point for the normalised path.
Instance Variable _data_dir Undocumented
Instance Variable _engine Undocumented
Instance Variable _thing Undocumented
def unique_scan_name(self, scan_name: str) -> str: (source)

Get the next unique scan name starting with the given name.

For more explanation on the scan naming see new_scan_dir

def _card_actions(self, entry: GalleryEntry) -> list[ActionButton]: (source)

Create the action buttons for this entry's card if it can be stitched.

def _card_messages(self, entry: GalleryEntry) -> list[GalleryCardMessages]: (source)

Create the alerts at the bottom of the Scan cards.

def _create_viewer_data(self, entry: GalleryEntry) -> DZIViewerData | None: (source)

Create the viewer data for the GalleryEntryModel.

Parameters
entry:GalleryEntryThe GalleryEntry from the database for this item.
Returns
DZIViewerData | NoneUndocumented
def _delete_endpoint(self, path: str) -> str: (source)

Return the endpoint for deleting an entry (relative to the base URL).

Parameters
path:strThe normalised relative posixpath for the item. This is the primary key of the GalleryEntry table.
Returns
strUndocumented
def _download_buttons(self, entry: GalleryEntry) -> list[DownloadButton]: (source)

Create the download buttons for the scan.

def _generate_entry(self, path: str, gallery_added_data: dict | None = None) -> GalleryEntry: (source)

Create a GalleryEntry for an item based on the data on disk.

Parameters
path:strThe normalised relative posixpath for the item. This is the primary key of the GalleryEntry table.
gallery_added_data:dict | NoneAny data added by the gallery. This can be used to persist gallery added data even if item is modified on disk.
Returns
GalleryEntryA GalleryEntry for the item.
def _hash(self, path: str) -> str: (source)

Create a unique hash for an item.

For the scan this is a hash of the json file (if it exists) plus the scan modified timestamp.

Parameters
path:strThe normalised relative posixpath for the item to hash, in this case, the scan directory. This is the primary key of the GalleryEntry table.
Returns
strA unique identifier to check if the item has changed.
def _list_all_items_on_file_system(self) -> list[str]: (source)

List all the items on this file system.

Returns
list[str]A list of paths.