def storage_info(self):
        """ Information about the camera's storage. """
        info_p = ffi.new("CameraStorageInformation**")
        num_info_p = ffi.new("int*")
        lib.gp_camera_get_storageinfo(self._cam, info_p, num_info_p, self._ctx)
        infos = []
        for idx in range(num_info_p[0]):
            out = SimpleNamespace()
            struc = (info_p[0] + idx)
            fields = struc.fields
            if lib.GP_STORAGEINFO_BASE & fields:
                out.directory = next(
                    (d for d in self.list_all_directories()
                     if d.path == ffi.string(struc.basedir).decode()),
                    None)
            if lib.GP_STORAGEINFO_LABEL & fields:
                out.label = ffi.string(struc.label).decode()
            if lib.GP_STORAGEINFO_DESCRIPTION & fields:
                out.description = ffi.string(struc.description).decode()
            if lib.GP_STORAGEINFO_STORAGETYPE & fields:
                stype = struc.type
                if lib.GP_STORAGEINFO_ST_FIXED_ROM & stype:
                    out.type = 'fixed_rom'
                elif lib.GP_STORAGEINFO_ST_REMOVABLE_ROM & stype:
                    out.type = 'removable_rom'
                elif lib.GP_STORAGEINFO_ST_FIXED_RAM & stype:
                    out.type = 'fixed_ram'
                elif lib.GP_STORAGEINFO_ST_REMOVABLE_RAM & stype:
                    out.type = 'removable_ram'
                else:
                    out.type = 'unknown'
            if lib.GP_STORAGEINFO_ACCESS & fields:
                if lib.GP_STORAGEINFO_AC_READWRITE & struc.access:
                    out.access = 'read-write'
                elif lib.GP_STORAGEINFO_AC_READONLY & struc.access:
                    out.access = 'read-only'
                elif lib.GP_STORAGEINFO_AC_READONLY_WITH_DELETE & struc.access:
                    out.access = 'read-delete'
            if lib.GP_STORAGEINFO_MAXCAPACITY & fields:
                out.capacity = int(struc.capacitykbytes)
            if lib.GP_STORAGEINFO_FREESPACEKBYTES & fields:
                out.free_space = int(struc.freekbytes)
            if lib.GP_STORAGEINFO_FREESPACEIMAGES & fields:
                out.remaining_images = int(struc.freeimages)
            infos.append(out)
        return infos
def storage_info ( self ) : info_p = ffi . new ( "CameraStorageInformation**" ) num_info_p = ffi . new ( "int*" ) lib . gp_camera_get_storageinfo ( self . _cam , info_p , num_info_p , self . _ctx ) infos = [ ] for idx in range ( num_info_p [ 0 ] ) : out = SimpleNamespace ( ) struc = ( info_p [ 0 ] + idx ) fields = struc . fields if lib . GP_STORAGEINFO_BASE & fields : out . directory = next ( ( d for d in self . list_all_directories ( ) if d . path == ffi . string ( struc . basedir ) . decode ( ) ) , None ) if lib . GP_STORAGEINFO_LABEL & fields : out . label = ffi . string ( struc . label ) . decode ( ) if lib . GP_STORAGEINFO_DESCRIPTION & fields : out . description = ffi . string ( struc . description ) . decode ( ) if lib . GP_STORAGEINFO_STORAGETYPE & fields : stype = struc . type if lib . GP_STORAGEINFO_ST_FIXED_ROM & stype : out . type = 'fixed_rom' elif lib . GP_STORAGEINFO_ST_REMOVABLE_ROM & stype : out . type = 'removable_rom' elif lib . GP_STORAGEINFO_ST_FIXED_RAM & stype : out . type = 'fixed_ram' elif lib . GP_STORAGEINFO_ST_REMOVABLE_RAM & stype : out . type = 'removable_ram' else : out . type = 'unknown' if lib . GP_STORAGEINFO_ACCESS & fields : if lib . GP_STORAGEINFO_AC_READWRITE & struc . access : out . access = 'read-write' elif lib . GP_STORAGEINFO_AC_READONLY & struc . access : out . access = 'read-only' elif lib . GP_STORAGEINFO_AC_READONLY_WITH_DELETE & struc . access : out . access = 'read-delete' if lib . GP_STORAGEINFO_MAXCAPACITY & fields : out . capacity = int ( struc . capacitykbytes ) if lib . GP_STORAGEINFO_FREESPACEKBYTES & fields : out . free_space = int ( struc . freekbytes ) if lib . GP_STORAGEINFO_FREESPACEIMAGES & fields : out . remaining_images = int ( struc . freeimages ) infos . append ( out ) return infos
Information about the camera's storage.