diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-06-28 21:35:52 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-06-28 21:35:52 +0200 |
commit | b86540b743f1a87a163ffb811c8fe22a01fefa38 (patch) | |
tree | b47cb3bb83c2377234226fb3987ab3320a987dd9 /src/MetadataWriter.vala | |
parent | ac6e0b731b9f0b2efd392e3309a5c07e2a66adad (diff) | |
parent | e905d8e16eec152d19797937f13ba3cf4b8f8aca (diff) |
Merge branch 'release/debian/0.32.1-1'debian/0.32.1-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); } |