Ejemplo n.º 1
0
 def __init__(self, picture_size):
     self.picture_size = picture_size
     # Print the capabilities of the connected camera
     try:
         if gphoto2cffi_enabled:
             self.cap = gp.Camera()
         elif piggyphoto_enabled:
             self.cap = gp.camera()
             print(self.cap.abilities)
         else:
             print(self.call_gphoto("-a", "/dev/null"))
     except CameraException as e:
         print('Warning: Listing camera capabilities failed (' + e.message +
               ')')
     except gpExcept as e:
         print('Warning: Listing camera capabilities failed (' + e.message +
               ')')
Ejemplo n.º 2
0
    def __init__(self, resolution=(10000, 10000), camera_rotate=False):
        self.resolution = resolution  # XXX Not used for gphoto?
        self.rotate = camera_rotate
        self.gphoto2cffi_buggy_capture = False  # Work around bug in capture()?

        # Print the capabilities of the connected camera
        try:
            if gphoto2cffi_enabled:
                try:
                    print "Connecting to camera using gphoto2cffi"
                    self.cap = gp.Camera()
                    print(self.cap.status)
                    print(self.cap.supported_operations)
                except gp.errors.GPhoto2Error as e:
                    print('Error: Could not open camera (' + e.message + ')')
                    print(
                        'Make sure camera is turned on and plugged in, then restart this program.'
                    )
                    raise e
                except gp.errors.UnsupportedDevice as e:
                    print('Error: Could not open camera (' + e.message + ')')
                    print(
                        'Make sure camera is turned on and plugged in, then restart this program.'
                    )
                    raise e
            elif piggyphoto_enabled:
                print "Connecting to camera using piggyphoto"
                self.cap = gp.camera()
                print(self.cap.abilities)
            else:
                print "Connecting to camera using command line gphoto2"
                print(self.call_gphoto("-a"))
        except CameraException as e:
            if "not found" in e.message:
                print(
                    "Could not find the 'gphoto2' command. Try: sudo apt-get install gphoto2"
                )
                exit(1)
            else:
                print('Warning: Listing camera capabilities failed (' +
                      e.message + ')')

        except gpExcept as e:
            print('Warning: Listing camera capabilities failed (' + e.message +
                  ')')
Ejemplo n.º 3
0
 def __init__(self, picture_size):
     global fake_enabled
     self.picture_size = picture_size
     # Print the capabilities of the connected camera
     try:
         if gphoto2cffi_enabled:
             self.cap = gp.Camera()
             Logger.success(__name__,"{0} Connected".format(self.cap.model_name) )
         elif piggyphoto_enabled:
             self.cap = gp.camera()
             print(self.cap.abilities)
         else:
             print(self.call_gphoto("-a", "/dev/null"))
     except CameraException as e:
         Logger.warning(__name__,"Camera Error, Proceed with Fake Camera Mode...")
         fake_enabled = True
     except gpExcept as e:
         Logger.warning(__name__,"Camera Error, Proceed with Fake Camera Mode...")
         fake_enabled = True