Starting point for capture§

This python script serves as the entry point for capturing and uploading.

It detects cameras, creates uploaders and an updater, starts threads etc.

detectandstart.detect_picam(updater: libs.Updater.Updater) → tuple[source]§

Detects the existence of a picam on all SPC-OS devices this will return true if the picam is installed on other rpis it may return false if the raspberrypi-firmware-tools is not installed or the boot.cfg flag for the camera is not set.

todo: this shoud return an empty tuple if an ivport is detected. todo: clean this up so that it doesnt require subprocess.

Creates:libs.Camera.PiCamera, libs.Uploader.Uploader
Parameters:updater (Updater) – instance that has a communication_queue member that implements an append method
Returns:tuple of raspberry pi camera thread and uploader.
Return type:tuple(PiCamera, Uploader)
detectandstart.detect_gphoto(updater: libs.Updater.Updater)[source]§

Detects DSLRs using borevitzlab/gphoto2-cffi.

Creates:libs.Camera.GPCamera, libs.Uploader.Uploader
Parameters:updater (Updater) – instance that has a communication_queue member that implements an append method
Returns:tuple of camera thread objects and associated uploader thread objects.
Return type:tuple(GPCamera, Uploader)
detectandstart.detect_webcam(updater: libs.Updater.Updater) → tuple[source]§

Detects usb web camers using the video4linux pyudev subsystem.

i.e. if the camera shows up as a /dev/videoX device, it sould be detected here.

Creates:libs.Camera.USBCamera, libs.Uploader.Uploader
Parameters:updater (Updater) – instance that has a communication_queue member that implements an append method
Returns:tuple of camera thread objects and associated uploader thread objects.
Return type:tuple(USBCamera, Uploader)
detectandstart.detect_sensors(updater: libs.Updater.Updater) → tuple[source]§

Detects sensors from sensor_list file. This is stupid, hacky and awful.

TODO: make this better and not permanently linked to sftp.traitcapture.org

Creates:libs.Sensor.Sensor, libs.Uploader.Uploader
Parameters:updater (Updater) – instance that has a communication_queue member that implements an append method
Returns:tuple of started sensor objects and uploaders for their data
Return type:tuple(Sensor, Uploader)
detectandstart.detect_ivport(updater: libs.Updater.Updater) → tuple[source]§

Method to detect IVport multiplexer. Its difficult to actually detect the existence of an ivport so we must just assume taht it exists if there is a config file matching the right pattern

Creates:libs.Camera.IVPortCamera, libs.Uploader.Uploader
Parameters:updater (Updater) – instance that has a communication_queue member that implements an append method
Returns:tuple of camera thread objects and associated uploader thread objects.
Return type:tuple(Camera, Uploader)
detectandstart.get_default_camera_conf(ident)[source]§
detectandstart.run_from_global_config(updater: libs.Updater.Updater) → tuple[source]§

Runs the startup from a yaml file defining the devices connected to the raspberry pi.

Parameters:updater
Returns:
detectandstart.enumerate_usb_devices() → set[source]§

Gets a set of the current usb devices from pyudev

Returns:set of pyudev usb device objects
Return type:set(pyudev.Device)
detectandstart.start_workers(worker_objects: tuple) → tuple[source]§

Starts threaded workers

Parameters:worker_objects – tuple of worker objects (threads)
Returns:tuple of started worker objects
Return type:tuple(threading.Thread)
detectandstart.kill_workers(worker_objects: tuple)[source]§

stops all workers

calls the stop method of the workers (they should all implement this as they are threads).

Parameters:worker_objects (tuple(threading.Thread)) –