class ScanDirectoryManager: (source)
Constructor: ScanDirectoryManager(base_scan_dir)
A class for managing interactions with scan directories.
| Method | __init__ |
Initialise the scan directory manager. |
| Method | all |
Return a lists of ScanInfo objects for each scan. |
| Method | check |
Raise an exception if there is not enough free disk space to continue scanning. |
| Method | delete |
Delete a scan. |
| Method | exists |
Return True if scan of this name exists on disk. |
| Method | get |
Return the full file path for the file within a scan directory. |
| Method | get |
Return the full file path for the file within a scan directory. |
| Method | get |
Return the file full path for the final stitch. |
| Method | get |
Return the scan data read from a JSON file as a dict. |
| Method | get |
Return the file full path scan data JSON file. |
| Method | img |
Return the path for the image dir for a given scan name. |
| Method | new |
Get a unique name for this scan and create a directory for it. |
| Method | path |
Return the path for a given scan name. |
| Method | zip |
Zips any images from the scan not yet zipped, return full path to zip. |
| Property | all |
Return a list of the scan names in the base directory. |
| Property | base |
The base directory scans are saved to. |
| Method | _unique |
Get the next unique scan name starting with the given name. |
| Instance Variable | _base |
Undocumented |
| Instance Variable | _lock |
Undocumented |
Initialise the scan directory manager.
| Parameters | |
basestr | Path of the directory that holds all scans. |
Raise an exception if there is not enough free disk space to continue scanning.
| Parameters | |
minint | the minimum space required in bytes. Default = 500,000,000 (500MB) |
| Raises | |
NotEnoughFreeSpaceError | if the remaining storage is below min_space |
str, filename: str, check_exists: bool = False) -> str | None:
(source)
¶
Return the full file path for the file within a scan directory.
If check_exists is True then None will be returned if the file does not exist.
str, filename: str, check_exists: bool = False) -> str | None:
(source)
¶
Return the full file path for the file within a scan directory.
If check_exists is True, None is returned if the file does not exist. If False then the path is returned anyway
Return the scan data read from a JSON file as a dict.
This is a dictionary not a base model as the data format has changed somewhat over time.
Get a unique name for this scan and create a directory for it.
The scan will be named {scan_name}_0001 where the number is zero-padded to be SCAN_ZERO_PAD_DIGITS digits long (to allow correct sorting if the scans are ordered alphanumerically).
Creates a new empty folder, into which scans are saved
Returns the a ScanDirectory object
Zips any images from the scan not yet zipped, return full path to zip.
final_version Set true to stitch all files not just the scan images this should only be done at the end as it is not possible to update a file in a zip.
Get the next unique scan name starting with the given name.
For more explanation on the scan naming see new_scan_dir