SVN commit 717762 by cgilles:
libkexiv2 from trunk (KDE4) : start to sync database using XMP with digiKam: - Store Data & Time in XMP tags. - Extract Date & Time from XMP tags if Exif info is not found. CCMAIL: [hidden email] M +13 -5 kexiv2.cpp M +145 -47 kexiv2image.cpp M +7 -7 kexiv2xmp.cpp --- trunk/extragear/libs/libkexiv2/libkexiv2/kexiv2.cpp #717761:717762 @@ -46,9 +46,11 @@ setComments(metadata.commentsMetaData()); setExif(metadata.exifMetaData()); setIptc(metadata.iptcMetaData()); + #ifdef _XMP_SUPPORT_ setXmp(metadata.xmpMetaData()); -#endif +#endif // _XMP_SUPPORT_ + setFilePath(metadata.getFilePath()); } @@ -69,9 +71,11 @@ setComments(metadata.commentsMetaData()); setExif(metadata.exifMetaData()); setIptc(metadata.iptcMetaData()); + #ifdef _XMP_SUPPORT_ setXmp(metadata.xmpMetaData()); -#endif +#endif // _XMP_SUPPORT_ + setFilePath(metadata.getFilePath()); return *this; } @@ -84,7 +88,7 @@ return true; #else return false; -#endif +#endif // _XMP_SUPPORT_ } QString KExiv2::Exiv2Version() @@ -148,11 +152,13 @@ d->iptcMetadata = image->iptcData(); #ifdef _XMP_SUPPORT_ + // Xmp metadata ----------------------------------- d->xmpMetadata = image->xmpData(); -#endif +#endif // _XMP_SUPPORT_ + d->filePath = filePath; return true; @@ -218,8 +224,10 @@ { image->setXmpData(d->xmpMetadata); } -#endif + +#endif // _XMP_SUPPORT_ + image->writeMetadata(); return true; --- trunk/extragear/libs/libkexiv2/libkexiv2/kexiv2image.cpp #717761:717762 @@ -25,6 +25,10 @@ * * ============================================================ */ +// Qt includes. + +#include "QtDebug" + // Local includes. #include "kexiv2private.h" @@ -389,84 +393,161 @@ if (!d->exifMetadata.empty()) { - // Try Exif date time original. - Exiv2::ExifData exifData(d->exifMetadata); - Exiv2::ExifKey key2("Exif.Photo.DateTimeOriginal"); - Exiv2::ExifData::iterator it2 = exifData.findKey(key2); - - if (it2 != exifData.end()) { - QDateTime dateTime = QDateTime::fromString(it2->toString().c_str(), Qt::ISODate); - - if (dateTime.isValid()) + Exiv2::ExifKey key("Exif.Photo.DateTimeOriginal"); + Exiv2::ExifData::iterator it = exifData.findKey(key); + if (it != exifData.end()) { - // qDebug("DateTime (Exif original): %s", dateTime.toString().toAscii().constData()); - return dateTime; + QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); + if (dateTime.isValid()) + { + qDebug() << "DateTime => Exif.Photo.DateTimeOriginal => " << dateTime << endl; + return dateTime; + } } } - - // Bogus Exif date time original entry. Try Exif date time digitized. - - Exiv2::ExifKey key3("Exif.Photo.DateTimeDigitized"); - Exiv2::ExifData::iterator it3 = exifData.findKey(key3); - - if (it3 != exifData.end()) { - QDateTime dateTime = QDateTime::fromString(it3->toString().c_str(), Qt::ISODate); - - if (dateTime.isValid()) + Exiv2::ExifKey key("Exif.Photo.DateTimeDigitized"); + Exiv2::ExifData::iterator it = exifData.findKey(key); + if (it != exifData.end()) { - // qDebug("DateTime (Exif digitalized): %s", dateTime.toString().toAscii().constData()); - return dateTime; + QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); + if (dateTime.isValid()) + { + qDebug() << "DateTime => Exif.Photo.DateTimeDigitized => " << dateTime << endl; + return dateTime; + } } } + { + Exiv2::ExifKey key("Exif.Image.DateTime"); + Exiv2::ExifData::iterator it = exifData.findKey(key); + if (it != exifData.end()) + { + QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); + if (dateTime.isValid()) + { + qDebug() << "DateTime => Exif.Image.DateTime => " << dateTime << endl; + return dateTime; + } + } + } + } - // Bogus Exif date time digitized. Try standard Exif date time entry. + // In second, trying to get Date & time from Xmp tags. - Exiv2::ExifKey key("Exif.Image.DateTime"); - Exiv2::ExifData::iterator it = exifData.findKey(key); +#ifdef _XMP_SUPPORT_ - if (it != exifData.end()) + if (!d->xmpMetadata.empty()) + { + Exiv2::XmpData xmpData(d->xmpMetadata); { - QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); - - if (dateTime.isValid()) + Exiv2::XmpKey key("Xmp.exif.DateTimeOriginal"); + Exiv2::XmpData::iterator it = xmpData.findKey(key); + if (it != xmpData.end()) { - // qDebug("DateTime (Exif standard): %s", dateTime.toString().toAscii().constData()); - return dateTime; + QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); + if (dateTime.isValid()) + { + qDebug() << "DateTime => Xmp.exif.DateTimeOriginal => " << dateTime << endl; + return dateTime; + } } } + { + Exiv2::XmpKey key("Xmp.exif.DateTimeDigitized"); + Exiv2::XmpData::iterator it = xmpData.findKey(key); + if (it != xmpData.end()) + { + QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); + if (dateTime.isValid()) + { + qDebug() << "DateTime => Xmp.exif.DateTimeDigitized => " << dateTime << endl; + return dateTime; + } + } + } + { + Exiv2::XmpKey key("Xmp.photoshop.DateCreated"); + Exiv2::XmpData::iterator it = xmpData.findKey(key); + if (it != xmpData.end()) + { + QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); + if (dateTime.isValid()) + { + qDebug() << "DateTime => Xmp.photoshop.DateCreated => " << dateTime << endl; + return dateTime; + } + } + } + { + Exiv2::XmpKey key("Xmp.xmp.CreateDate"); + Exiv2::XmpData::iterator it = xmpData.findKey(key); + if (it != xmpData.end()) + { + QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); + if (dateTime.isValid()) + { + qDebug() << "DateTime => Xmp.xmp.CreateDate => " << dateTime << endl; + return dateTime; + } + } + } + { + Exiv2::XmpKey key("Xmp.xmp.ModifyDate"); + Exiv2::XmpData::iterator it = xmpData.findKey(key); + if (it != xmpData.end()) + { + QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); + if (dateTime.isValid()) + { + qDebug() << "DateTime => Xmp.xmp.ModifyDate => " << dateTime << endl; + return dateTime; + } + } + } + { + Exiv2::XmpKey key("Xmp.xmp.MetadataDate"); + Exiv2::XmpData::iterator it = xmpData.findKey(key); + if (it != xmpData.end()) + { + QDateTime dateTime = QDateTime::fromString(it->toString().c_str(), Qt::ISODate); + if (dateTime.isValid()) + { + qDebug() << "DateTime => Xmp.xmp.MetadataDate => " << dateTime << endl; + return dateTime; + } + } + } } - // In second, trying to get Date & time from Iptc tags. +#endif // _XMP_SUPPORT_ + // In third, trying to get Date & time from Iptc tags. + if (!d->iptcMetadata.empty()) { + Exiv2::IptcData iptcData(d->iptcMetadata); + // Try creation Iptc date time entries. Exiv2::IptcKey keyDateCreated("Iptc.Application2.DateCreated"); - Exiv2::IptcData iptcData(d->iptcMetadata); Exiv2::IptcData::iterator it = iptcData.findKey(keyDateCreated); - if (it != iptcData.end()) { QString IptcDateCreated(it->toString().c_str()); - Exiv2::IptcKey keyTimeCreated("Iptc.Application2.TimeCreated"); Exiv2::IptcData::iterator it2 = iptcData.findKey(keyTimeCreated); - if (it2 != iptcData.end()) { QString IptcTimeCreated(it2->toString().c_str()); - QDate date = QDate::fromString(IptcDateCreated, Qt::ISODate); QTime time = QTime::fromString(IptcTimeCreated, Qt::ISODate); QDateTime dateTime = QDateTime(date, time); - if (dateTime.isValid()) { - // qDebug("Date (IPTC created): %s", dateTime.toString().toAscii().constData()); + qDebug() << "DateTime => Iptc.Application2.DateCreated => " << dateTime << endl; return dateTime; } } @@ -476,25 +557,20 @@ Exiv2::IptcKey keyDigitizationDate("Iptc.Application2.DigitizationDate"); Exiv2::IptcData::iterator it3 = iptcData.findKey(keyDigitizationDate); - if (it3 != iptcData.end()) { QString IptcDateDigitization(it3->toString().c_str()); - Exiv2::IptcKey keyDigitizationTime("Iptc.Application2.DigitizationTime"); Exiv2::IptcData::iterator it4 = iptcData.findKey(keyDigitizationTime); - if (it4 != iptcData.end()) { QString IptcTimeDigitization(it4->toString().c_str()); - QDate date = QDate::fromString(IptcDateDigitization, Qt::ISODate); QTime time = QTime::fromString(IptcTimeDigitization, Qt::ISODate); QDateTime dateTime = QDateTime(date, time); - if (dateTime.isValid()) { - //qDebug("Date (IPTC digitalized): %s", dateTime.toString().toAscii().constData()); + qDebug() << "DateTime => Iptc.Application2.DigitizationDate => " << dateTime << endl; return dateTime; } } @@ -532,8 +608,30 @@ if(setDateTimeDigitized) d->exifMetadata["Exif.Photo.DateTimeDigitized"] = exifdatetime; - // In Second we write date & time into Iptc. +#ifdef _XMP_SUPPORT_ + // In second we write date & time into Xmp. + + const std::string &xmpdatetime(dateTime.toString(QString("yyyy:MM:dd hh:mm:ss")).toAscii().constData()); + + Exiv2::Value::AutoPtr xmpTxtVal = Exiv2::Value::create(Exiv2::xmpText); + xmpTxtVal->read(xmpdatetime); + d->xmpMetadata.add(Exiv2::XmpKey("Xmp.exif.DateTimeOriginal"), xmpTxtVal.get()); + d->xmpMetadata.add(Exiv2::XmpKey("Xmp.photoshop.DateCreated"), xmpTxtVal.get()); + d->xmpMetadata.add(Exiv2::XmpKey("Xmp.xmp.CreateDate"), xmpTxtVal.get()); + d->xmpMetadata.add(Exiv2::XmpKey("Xmp.xmp.MetadataDate"), xmpTxtVal.get()); + d->xmpMetadata.add(Exiv2::XmpKey("Xmp.xmp.ModifyDate"), xmpTxtVal.get()); if(setDateTimeDigitized) + d->xmpMetadata.add(Exiv2::XmpKey("Xmp.exif.DateTimeDigitized"), xmpTxtVal.get()); + + // Tag not updated: + // "Xmp.dc.DateTime" is a sequence of date relevant of dublin core change. + // This is not the picture date as well + // "Xmp.tiff.DateTime" is encoded as "Xmp.xmp:ModifyDate" by Exiv2. Not need to touch it. + +#endif // _XMP_SUPPORT_ + + // In third we write date & time into Iptc. + const std::string &iptcdate(dateTime.date().toString(Qt::ISODate).toAscii().constData()); const std::string &iptctime(dateTime.time().toString(Qt::ISODate).toAscii().constData()); d->iptcMetadata["Iptc.Application2.DateCreated"] = iptcdate; --- trunk/extragear/libs/libkexiv2/libkexiv2/kexiv2xmp.cpp #717761:717762 @@ -41,7 +41,7 @@ return !d->xmpMetadata.empty(); #else return false; -#endif +#endif // _XMP_SUPPORT_ } bool KExiv2::clearXmp() @@ -56,7 +56,7 @@ { printExiv2ExceptionError("Cannot clear Xmp data using Exiv2 ", e); } -#endif +#endif // _XMP_SUPPORT_ return false; } @@ -82,7 +82,7 @@ printExiv2ExceptionError("Cannot get Xmp data using Exiv2 ", e); } -#endif +#endif // _XMP_SUPPORT_ return QByteArray(); } @@ -110,7 +110,7 @@ printExiv2ExceptionError("Cannot set Xmp data using Exiv2 ", e); } -#endif +#endif // _XMP_SUPPORT_ return false; } @@ -183,7 +183,7 @@ { printExiv2ExceptionError("Cannot parse XMP metadata using Exiv2 ", e); } -#endif +#endif // _XMP_SUPPORT_ return MetaDataMap(); } @@ -201,7 +201,7 @@ { printExiv2ExceptionError("Cannot get metadata tag title using Exiv2 ", e); } -#endif +#endif // _XMP_SUPPORT_ return QString(); } @@ -219,7 +219,7 @@ { printExiv2ExceptionError("Cannot get metadata tag description using Exiv2 ", e); } -#endif +#endif // _XMP_SUPPORT_ return QString(); } _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
We should fix libtool version as soon as possible in my opinion...
That is important to avoid library conflicts with kde 3 ones, and of course binary compatibility issues. Hope to be present in the next few days in IRC (better #kde-imaging), to talk about it... Angelo _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel attachment0 (196 bytes) Download Attachment |
Angelo,
2007/9/28, Angelo Naselli <[hidden email]>: We should fix libtool version as soon as possible in my opinion... This is KDE4 code not KDE3. libkexiv2 soname for KDE4 have been set to 5. Look main CMakeList.txt file. , and of course Impossible. Qt4/KDE4 is not binary compatible with Qt3/KDE3 Hope to be present in the next few days in IRC (better #kde-imaging), to talk about it... ok Gilles _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
> This is KDE4 code not KDE3. libkexiv2 soname for KDE4 have been set to 5.
> Look main CMakeList.txt file. sorry? I'll take a look at it i can't understand what 5 stands for here... > , and of course > > binary compatibility issues. > > > Impossible. Qt4/KDE4 is not binary compatible with Qt3/KDE3 hmm but they can be both on the system and a file contained into pacakge can't be installed if it is already installed from another one. I mean libkexiv2 (for instance) can't be installed for both kde3 and kde4 version if it has the same so name or version... Angelo _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel attachment0 (196 bytes) Download Attachment |
2007/9/29, Angelo Naselli <[hidden email]>: > This is KDE4 code not KDE3. libkexiv2 soname for KDE4 have been set to 5. yes, i have overloaded temporally the soname version to 5. Like this we can release another one version for KDE3 without to have a conflict. Look my comments from CMakeFile.txt > , and of course It' can be possible. libkexiv2 header is installed where KDE version is installed (by defautl) For example, in my system (Mandriva cooker) with both KDE3 and KDE4, i have : KDE3 in /usr KDE4 in /opt/kde4 Gilles _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
> yes, i have overloaded temporally the soname version to 5. Like this we can
> release another one version for KDE3 without to have a conflict. > > Look my comments from CMakeFile.txt hmm, if i'm not wrong it's 6 :) > It' can be possible. libkexiv2 header is installed where KDE version is > installed (by defautl) > > For example, in my system (Mandriva cooker) with both KDE3 and KDE4, i have > : > > KDE3 in /usr > KDE4 in /opt/kde4 > > and there is no confiict ll /usr/lib64/libkexiv2* lrwxrwxrwx 1 root root 18 lug 20 22:32 /usr/lib64/libkexiv2.so.1 -> libkexiv2.so.1.1.1 -rw-r--r-- 1 root root 144528 lug 16 17:33 /usr/lib64/libkexiv2.so.1.1.1 ll /usr/lib64/libkdcraw* -rw-r--r-- 1 root root 1593 lug 16 17:33 /usr/lib64/libkdcraw.la lrwxrwxrwx 1 root root 18 lug 20 22:32 /usr/lib64/libkdcraw.so -> libkdcraw.so.1.0.0 lrwxrwxrwx 1 root root 18 lug 20 22:32 /usr/lib64/libkdcraw.so.1 -> libkdcraw.so.1.0.0 -rw-r--r-- 1 root root 110264 lug 16 17:33 /usr/lib64/libkdcraw.so.1.0.0 /usr/lib64/libkdcraw1: totale 246 drwxr-xr-x 2 root root 1024 lug 20 22:32 ./ drwxr-xr-x 137 root root 89088 set 5 00:02 ../ -rwxr-xr-x 1 root root 158784 lug 16 17:33 kdcraw* But yes a 6:0:0 makes it incopatble and we have 4/5 breaking releases :) I don't like this way to though.... Angelo _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel attachment0 (196 bytes) Download Attachment |
Free forum by Nabble | Edit this page |