Changeset 11514 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2017-01-30T23:21:38+01:00 (7 years ago)
Author:
Don-vip
Message:

fix #14209 - EXIF: prefer DATETIME over DATETIME_DIGITIZED

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ExifReader.java

    r11484 r11514  
    4444            Metadata metadata = JpegMetadataReader.readMetadata(filename);
    4545            String dateStr = null;
     46            String dateTime = null;
    4647            String subSeconds = null;
    4748            for (Directory dirIt : metadata.getDirectories()) {
     
    5253                    if (tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL /* 0x9003 */ &&
    5354                            !tag.getDescription().matches("\\[[0-9]+ .+\\]")) {
     55                        // prefer DATETIME_ORIGINAL
    5456                        dateStr = tag.getDescription();
    5557                    }
    56                     if (tag.getTagType() == ExifIFD0Directory.TAG_DATETIME /* 0x0132 */ ||
    57                         tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED /* 0x9004 */) {
    58                         if (dateStr == null) {
    59                             // prefer TAG_DATETIME_ORIGINAL
    60                             dateStr = tag.getDescription();
    61                         }
     58                    if (tag.getTagType() == ExifIFD0Directory.TAG_DATETIME /* 0x0132 */) {
     59                        // prefer DATETIME over DATETIME_DIGITIZED
     60                        dateTime = tag.getDescription();
     61                    }
     62                    if (tag.getTagType() == ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED /* 0x9004 */ && dateTime == null) {
     63                        dateTime = tag.getDescription();
    6264                    }
    6365                    if (tag.getTagType() == ExifIFD0Directory.TAG_SUBSECOND_TIME_ORIGINAL) {
     
    6567                    }
    6668                }
     69            }
     70            if (dateStr == null) {
     71                dateStr = dateTime;
    6772            }
    6873            if (dateStr != null) {
Note: See TracChangeset for help on using the changeset viewer.