4.3.1. PictureFetcher package¶
4.3.1.1. Submodules¶
4.3.1.2. PictureFetcher.pygphoto module¶
-
class
PictureFetcher.pygphoto.
Pygphoto
(watch_camera=False, watch_files=False)[source]¶ Bases:
PyQt5.QtCore.QObject
Allows simple operations on a USB connected camera by interfacing the gphoto2 command line tool.
This class allows to interact with a USB camera. List the names of the photos present in the camera, watch for new files, and eventually download the photos individually. Needs a QApplication to be instantiated in order to watch properly for events.
Parameters: - watch_camera=False (bool) – Should the daemon thread watch for camera connection.
- watch_files=False (bool) – Should the daemon thread watch for files creation/deletion.
-
check_camera_connected
()[source]¶ Returns: A boolean indicating the presence of a connected camera. Raises: CalledProcessError
– when gphoto2 raised an error.
-
download_all
(output_dir, overwrite=True, thumbnail=False)[source]¶ Download all the files present on the camera.
Overwrites preexisting files. Faster than ‘download_files()’.
Parameters: - output_dir (str) – The directory where the files should be downloaded to.
- overwrite=True (bool) – If any existing file with the same name should be overwritten.
- thumbnail=False (bool) – Download the thumbnail instead of the file.
Returns: The return code returned by the gphoto2
-
download_file
(filename, output_dir, overwrite=True, thumbnail=False)[source]¶ Download the file name “filename” and copy it to the given path.
Parameters: - filename (str) – The name of the file to download.
- output_dir (str) – The directory where the files should be downloaded to.
- overwrite=True (bool) – If any existing file with the same name should be overwritten.
- thumbnail=False (bool) – Download the thumbnail instead of the file.
Returns: 0 if succeeded. Else returns the error code returned by gphoto.
-
download_files
(filename_list, output_dir, overwrite=True, thumbnail=False)[source]¶ Download the whole list of files to the ouput directory
This is equivalent to calling download_file on every file in the “filename_list”, but should be faster for a large number of files.
Parameters: - filename_list (list) – The name list of files to download.
- output_dir (str) – The directory where the files should be downloaded to.
- overwrite=True (bool) – If any existing file with the same name should be overwritten.
- thumbnail=False (bool) – Download the thumbnail instead of the file.
Returns: files_list – The paths list of all downloaded files.
Return type: list
-
onCameraConnection
¶ pyqtSignal(bool)
This signal indicates if a camera is connected.
-
onContentChanged
¶ pyqtSignal(list, list)
When watching the camera for new files, emit this signal when there has been some changes in the camera filesystem. Arguments are the lists of new files and deleted files
-
query_file_list
()[source]¶ Generate the list of filenames for all the files present on the first camera found by requesting directly the camera.
Returns: The list of all filenames present on the camera. Raises: CalledProcessError
– when gphoto2 raised an error.
-
query_storage_info
()[source]¶ Returns: A dictionnary of values concerning memory usage {free, occupied, total} containing values in KB. Raises: CalledProcessError
– when gphoto2 raised an error.