diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-06-14 20:35:58 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-06-14 20:35:58 +0200 |
commit | d443a3c2509889533ca812c163056bace396b586 (patch) | |
tree | e94ffc0d9c054ca4efb8fb327e18dfac88e15dc7 /src/MetadataWriter.vala | |
parent | bb9797c14470641b082ebf635e2ae3cfd5f27a3b (diff) |
New upstream version 0.32.1upstream/0.32.1
Diffstat (limited to 'src/MetadataWriter.vala')
-rw-r--r-- | src/MetadataWriter.vala | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/MetadataWriter.vala b/src/MetadataWriter.vala index 0c23260..5fc26d1 100644 --- a/src/MetadataWriter.vala +++ b/src/MetadataWriter.vala @@ -15,7 +15,7 @@ public class MetadataWriter : Object { public const uint COMMIT_DELAY_MSEC = 3000; public const uint COMMIT_SPACING_MSEC = 50; - private const string[] INTERESTED_PHOTO_METADATA_DETAILS = { "name", "comment", "rating", "exposure-time" }; + private const string[] INTERESTED_PHOTO_METADATA_DETAILS = { "name", "comment", "rating", "exposure-time", "gps" }; private class CommitJob : BackgroundJob { public LibraryPhoto photo; @@ -108,18 +108,26 @@ public class MetadataWriter : Object { } // exposure date/time - time_t current_exposure_time = photo.get_exposure_time(); - time_t metadata_exposure_time = 0; + DateTime? current_exposure_time = photo.get_exposure_time(); + DateTime? metadata_exposure_time = null; MetadataDateTime? metadata_exposure_date_time = metadata.get_exposure_date_time(); if (metadata_exposure_date_time != null) metadata_exposure_time = metadata_exposure_date_time.get_timestamp(); if (current_exposure_time != metadata_exposure_time) { - metadata.set_exposure_date_time(current_exposure_time != 0 + metadata.set_exposure_date_time(current_exposure_time != null ? new MetadataDateTime(current_exposure_time) : null); changed = true; } + // gps location + GpsCoords current_gps_coords = photo.get_gps_coords(); + GpsCoords metadata_gps_coords = metadata.get_gps_coords(); + if (!current_gps_coords.equals(ref metadata_gps_coords)) { + metadata.set_gps_coords(current_gps_coords); + changed = true; + } + // tags (keywords) ... replace (or clear) entirely rather than union or intersection Gee.Set<string> safe_keywords = new Gee.HashSet<string>(); @@ -681,7 +689,7 @@ public class MetadataWriter : Object { try { job.photo.set_master_metadata_dirty(false); - } catch (DatabaseError err) { + } catch (Error err) { AppWindow.database_error(err); } |