[shotwell] Improved Raw duplicate detection



commit 59da83435bfe4f14a716312f5cc871f9c04d6774
Author: Amos Brocco <amos brocco gmail com>
Date:   Sun Nov 27 22:17:00 2016 +0000

    Improved Raw duplicate detection
    
    Use exposure timestamp comparison as well as file name to distinguish between
    different files with the same name
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775196

 src/camera/ImportPage.vala |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/src/camera/ImportPage.vala b/src/camera/ImportPage.vala
index 734c06d..4e055ec 100644
--- a/src/camera/ImportPage.vala
+++ b/src/camera/ImportPage.vala
@@ -338,14 +338,22 @@ class ImportPreview : MediaSourceItem {
                 uint64 filesize = get_import_source().get_filesize();
                 // unlikely to be a problem, but what the hay
                 if (filesize <= int64.MAX) {
-                    if (LibraryPhoto.global.has_basename_filesize_duplicate(
-                        get_import_source().get_filename(), (int64) filesize)) {
+                    PhotoID duplicated_photo_id = LibraryPhoto.global.get_basename_filesize_duplicate(
+                                get_import_source().get_filename(), (int64) filesize);
+
+                    if (duplicated_photo_id.is_valid()) {
+                        // Check exposure timestamp
+                        LibraryPhoto duplicated_photo = LibraryPhoto.global.fetch(duplicated_photo_id);
+                        time_t photo_exposure_time = photo_import_source.get_exposure_time();
+                        time_t duplicated_photo_exposure_time = duplicated_photo.get_exposure_time();
                         
-                        duplicated_file = DuplicatedFile.create_from_photo_id(
-                            LibraryPhoto.global.get_basename_filesize_duplicate(
-                            get_import_source().get_filename(), (int64) filesize));
-                        
-                        return true;
+                        if (photo_exposure_time == duplicated_photo_exposure_time) {
+                            duplicated_file = DuplicatedFile.create_from_photo_id(
+                                LibraryPhoto.global.get_basename_filesize_duplicate(
+                                get_import_source().get_filename(), (int64) filesize));
+
+                            return true;
+                        }
                     }
                 }
             }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]