[shotwell] Use importable exposure time if available when importing media.



commit 76240755541fa545ee89c8ce52e22746f0c4aa9d
Author: Tim Waugh <twaugh redhat com>
Date:   Sat Dec 27 19:19:24 2014 +0000

    Use importable exposure time if available when importing media.

 src/data_imports/DataImportJob.vala    |    4 ++++
 src/data_imports/DataImportSource.vala |    8 ++++++--
 src/plugins/DataImportsInterfaces.vala |    2 ++
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/data_imports/DataImportJob.vala b/src/data_imports/DataImportJob.vala
index b27997c..3a1b3e3 100644
--- a/src/data_imports/DataImportJob.vala
+++ b/src/data_imports/DataImportJob.vala
@@ -157,6 +157,10 @@ public class DataImportJob : BatchImportJob {
         string? title = src_photo.get_title();
         if (title != null)
             photo.set_title(title);
+        // exposure time
+        time_t? date_time = src_photo.get_exposure_time();
+        if (date_time != null)
+            photo.set_exposure_time(date_time);
         // import ID
         photo.set_import_id(import_roll.import_id);
         
diff --git a/src/data_imports/DataImportSource.vala b/src/data_imports/DataImportSource.vala
index ff88d34..bac7efc 100644
--- a/src/data_imports/DataImportSource.vala
+++ b/src/data_imports/DataImportSource.vala
@@ -48,12 +48,16 @@ public class DataImportSource {
                 warning("Could not get file metadata for %s: %s", get_filename(), e.message);
                 metadata = null;
             }
-            
-            exposure_time = (metadata != null) ? metadata.get_exposure_date_time() : null;
             title = db_photo.get_title();
             if (title == null) {
                 title = (metadata != null) ? metadata.get_title() : null;
             }
+            time_t? date_time = db_photo.get_exposure_time();
+            if (date_time != null) {
+                exposure_time = new MetadataDateTime(date_time);
+            } else {
+                exposure_time = (metadata != null) ? metadata.get_exposure_date_time() : null;
+            }
             PhotoPreview? preview = metadata != null ? metadata.get_preview(0) : null;
             if (preview != null) {
                 try {
diff --git a/src/plugins/DataImportsInterfaces.vala b/src/plugins/DataImportsInterfaces.vala
index 154503b..c4d7329 100644
--- a/src/plugins/DataImportsInterfaces.vala
+++ b/src/plugins/DataImportsInterfaces.vala
@@ -119,6 +119,8 @@ public interface ImportableMediaItem : GLib.Object {
     public abstract string get_folder_path();
     
     public abstract string get_filename();
+
+    public abstract time_t? get_exposure_time();
 }
 
 /**


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