Use rating from EXIF/XMP where available
This commit is contained in:
parent
7512093c20
commit
820024972a
@ -188,10 +188,18 @@ FrameData::FrameData (rtexif::TagDirectory* frameRootDir_, rtexif::TagDirectory*
|
|||||||
orientation = tag->valueToString ();
|
orientation = tag->valueToString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Look for Rating metadata in the following order:
|
||||||
|
// 1. EXIF
|
||||||
|
// 2. XMP
|
||||||
|
// 3. pp3 sidecar file
|
||||||
tag = newFrameRootDir->findTagUpward("Rating");
|
tag = newFrameRootDir->findTagUpward("Rating");
|
||||||
if (tag) {
|
if (tag && tag->toInt() != 0) {
|
||||||
rating = tag->toInt();
|
rating = tag->toInt();
|
||||||
}
|
}
|
||||||
|
char sXMPRating[64];
|
||||||
|
if (newFrameRootDir->getXMPTagValue("xmp:Rating", sXMPRating)) {
|
||||||
|
rating = atoi(sXMPRating);
|
||||||
|
}
|
||||||
|
|
||||||
tag = newFrameRootDir->findTagUpward("MakerNote");
|
tag = newFrameRootDir->findTagUpward("MakerNote");
|
||||||
rtexif::TagDirectory* mnote = nullptr;
|
rtexif::TagDirectory* mnote = nullptr;
|
||||||
|
@ -48,8 +48,8 @@ protected:
|
|||||||
double expcomp;
|
double expcomp;
|
||||||
std::string make, model, serial;
|
std::string make, model, serial;
|
||||||
std::string orientation;
|
std::string orientation;
|
||||||
std::string lens;
|
|
||||||
int rating;
|
int rating;
|
||||||
|
std::string lens;
|
||||||
IIOSampleFormat sampleFormat;
|
IIOSampleFormat sampleFormat;
|
||||||
|
|
||||||
// each frame has the knowledge of "being an"
|
// each frame has the knowledge of "being an"
|
||||||
|
@ -2832,7 +2832,10 @@ void ProcParams::setDefaults()
|
|||||||
exif.clear();
|
exif.clear();
|
||||||
iptc.clear();
|
iptc.clear();
|
||||||
|
|
||||||
rank = 0;
|
// -1 means that there's no pp3 data with rank yet. In this case, the
|
||||||
|
// embedded Rating metadata should take precedence. -1 should never be
|
||||||
|
// written to pp3 on disk.
|
||||||
|
rank = -1;
|
||||||
colorlabel = 0;
|
colorlabel = 0;
|
||||||
inTrash = false;
|
inTrash = false;
|
||||||
|
|
||||||
|
@ -1006,15 +1006,22 @@ void Thumbnail::setFileName (const Glib::ustring &fn)
|
|||||||
|
|
||||||
int Thumbnail::getRank () const
|
int Thumbnail::getRank () const
|
||||||
{
|
{
|
||||||
|
// prefer the user-set rank over the embedded Rating
|
||||||
|
// pparams->rank == -1 means that there is no saved rank yet, so we should
|
||||||
|
// next look for the embedded Rating metadata.
|
||||||
|
if (pparams->rank != -1) {
|
||||||
return pparams->rank;
|
return pparams->rank;
|
||||||
|
} else {
|
||||||
|
return cfs.rating;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thumbnail::setRank (int rank)
|
void Thumbnail::setRank (int rank)
|
||||||
{
|
{
|
||||||
if (pparams->rank != rank) {
|
if (pparams->rank != rank) {
|
||||||
pparams->rank = rank;
|
pparams->rank = rank;
|
||||||
pparamsValid = true;
|
|
||||||
}
|
}
|
||||||
|
pparamsValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Thumbnail::getColorLabel () const
|
int Thumbnail::getColorLabel () const
|
||||||
|
@ -164,17 +164,8 @@ public:
|
|||||||
return cfs.md5;
|
return cfs.md5;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRank () const
|
int getRank () const;
|
||||||
{
|
void setRank (int rank);
|
||||||
return cfs.rating;
|
|
||||||
}
|
|
||||||
void setRank (int rank)
|
|
||||||
{
|
|
||||||
if (cfs.rating != rank) {
|
|
||||||
cfs.rating = rank;
|
|
||||||
}
|
|
||||||
pparamsValid = true; // FIXME-piotr Is this the right way to refresh the cache? Probably not since pparams and cache should be 2 different things
|
|
||||||
}
|
|
||||||
|
|
||||||
int getColorLabel () const;
|
int getColorLabel () const;
|
||||||
void setColorLabel (int colorlabel);
|
void setColorLabel (int colorlabel);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user