[Digikam-devel] [Bug 107316] Option: Only download new photos from camera

Gilles Caulier caulier.gilles at gmail.com
Thu Nov 6 11:20:53 GMT 2008


http://bugs.kde.org/show_bug.cgi?id=107316





--- Comment #34 from Gilles Caulier <caulier gilles gmail com>  2008-11-06 12:20:51 ---
Arnd,

Yes, technically this file can be closed.

I will be more precise how uploaded images detection work:

- The database record for each item downloaded these infos:
 * a MD5 fingerprint (QString).
 * File name as QString.
 * File date as QDateTime.
 * File size in Kb as integer.

 See this method for details: 

http://lxr.kde.org/source/extragear/graphics/digikam/libs/database/downloadhistory.h#060

- With USB Mass Camera, i use Solid interface UUID of camera media to compute
the MD5 fingerprint in Database:

http://lxr.kde.org/source/extragear/graphics/digikam/utilities/cameragui/umscamera.cpp#080

 Like this, we are able to detect if file is already downloaded if media is
plugged in another device as a card reader instead the camera.

- With Gphoto2 camera, it's more complex, because there is no way to get camera
media UUID. I have ask to Marcus from Gphoto2 team, and he confirm this point.
So i use another way, less powerfull: 

http://lxr.kde.org/source/extragear/graphics/digikam/utilities/cameragui/gpcamera.cpp#148

 I compute fingerprint using camera settings : mount path, port, and model.
This way restrict uploaded images detection to camera device, not camera media.
If you plug memory card in a card reader, digiKam will not reconize already
downloaded items.

 I know that Gphoto2 provide a way to get camera media informations as it
defined in gphoto2-filesystem.h:

/** 
 * \brief Storage information flags.
 *                                  
 * Bitmask to specify which entries of the filesystem
 * storage information is set.                       
 */                                                  
typedef enum {                                       
        GP_STORAGEINFO_BASE             = (1<<0),       /**< \brief The base
directory. 
                                                         * Usually / if just 1
storage is attached.
                                                         */                     
        GP_STORAGEINFO_LABEL            = (1<<1),       /**< \brief Label of
the filesystem.       
                                                         * Could also be a DOS
label.              
                                                         */                     
        GP_STORAGEINFO_DESCRIPTION      = (1<<2),       /**< \brief More
verbose description. */   
        GP_STORAGEINFO_ACCESS           = (1<<3),       /**< \brief Access
permissions. */         
        GP_STORAGEINFO_STORAGETYPE      = (1<<4),       /**< \brief Hardware
type. */              
        GP_STORAGEINFO_FILESYSTEMTYPE   = (1<<5),       /**< \brief Filesystem
type. */            
        GP_STORAGEINFO_MAXCAPACITY      = (1<<6),       /**< \brief Maximum
capacity in kbytes */  
        GP_STORAGEINFO_FREESPACEKBYTES  = (1<<7),       /**< \brief Free space
in kbytes. */       
        GP_STORAGEINFO_FREESPACEIMAGES  = (1<<8)        /**< \brief Free space
in images. */       
} CameraStorageInfoFields;                                                      

/**
 * \brief Hardware storage types.
 *                               
 * Type of hardware this storage is on. The types and values
 * are the same as the PTP standard uses (PTP_ST_xxx).      
 */                                                         
typedef enum {                                              
        GP_STORAGEINFO_ST_UNKNOWN       = 0,    /**< \brief Unknown storage
type. */
        GP_STORAGEINFO_ST_FIXED_ROM     = 1,    /**< \brief A fixed ROM
storage. */ 
        GP_STORAGEINFO_ST_REMOVABLE_ROM = 2,    /**< \brief A removable ROM
storage. */
        GP_STORAGEINFO_ST_FIXED_RAM     = 3,    /**< \brief A fixed RAM
storage. (e.g. SDRAM) */
        GP_STORAGEINFO_ST_REMOVABLE_RAM = 4     /**< \brief A removable RAM
storage. (any kind of cards etc) */
} CameraStorageType;                                                            

/**
 * \brief Storage access modes.
 *                             
 * The modes we can access the storage with. Uses the same
 * types and values as the PTP standard (PTP_AC_xxx).     
 */                                                       
typedef enum {                                            
        GP_STORAGEINFO_AC_READWRITE             = 0,    /**< \brief Storage is
Read / Write. */
        GP_STORAGEINFO_AC_READONLY              = 1,    /**< \brief Storage is
Ready Only. */  
        GP_STORAGEINFO_AC_READONLY_WITH_DELETE  = 2     /**< \brief Storage is
Ready Only, but allows Delete.*/
} CameraStorageAccessType;                                                      

/**
 * \brief Filesystem hierarchy types.
 *                                   
 * The type of the filesystem hierarchy the devices uses.
 * Same types and values as the PTP standard defines (PTP_FST_xxx).
 */                                                                
typedef enum {                                                     
        GP_STORAGEINFO_FST_UNDEFINED            = 0,    /**< \brief Undefined
or unknown filesystem hierarchy. */
        GP_STORAGEINFO_FST_GENERICFLAT          = 1,    /**< \brief Generic
flat storage (all in 1 directory). */
        GP_STORAGEINFO_FST_GENERICHIERARCHICAL  = 2,    /**< \brief Generic
tree hierarchy. */                   
        GP_STORAGEINFO_FST_DCF                  = 3     /**< \brief DCIM style
storage. */                       
} CameraStorageFilesystemType;                         

/**
 * \brief Storage information structure.
 *                                     
 * This structure contains the information of a specific camera storage.
 * Only the members as specified by the \a fields member are valid.     
 */                                                                     
typedef struct _CameraStorageInformation {                              
        CameraStorageInfoFields         fields; /**< \brief Bitmask of struct
members that are specified. */
        char                            basedir[256];   /**< \brief
Basedirectory of the storage. Will be "/" if just 1 storage on the camera. */   
        char                            label[256];     /**< \brief Label of
the storage. Similar to DOS label. */            
        char                            description[256];/**< \brief
Description of the storage. */                           
        CameraStorageType               type;           /**< \brief Hardware
type of the storage. */                          
        CameraStorageFilesystemType     fstype;         /**< \brief Hierarchy
type of the filesystem. */                      
        CameraStorageAccessType         access;         /**< \brief Access
permissions. */                                    
        uint64_t                        capacitykbytes; /**< \brief Total
capacity in kbytes. */                              
        uint64_t                        freekbytes;     /**< \brief Free space
in kbytes. */                                  
        uint64_t                        freeimages;     /**< \brief Free space
in images (guessed by camera). */              
} CameraStorageInformation; 

But, like you can see, there is no universal and uniq information about camera
media...
Note that Solid interface cannot help here. It cannot play indeep yet with
Gphoto2 camera device.

So, the thread still open if somebody as a better way to proposal.

Gilles


-- 
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Digikam-devel mailing list