Commit 3d4c3bda authored by Paolo Bacchilega's avatar Paolo Bacchilega

sync the rating value with Xmp.xmp.Rating metadata

as suggested in comment #4 of bug #480001
parent c85991c3
......@@ -170,6 +170,12 @@ const char *_KEYWORDS_TAG_NAMES[] = {
NULL
};
const char *_RATING_TAG_NAMES[] = {
"Xmp::xmp::Rating",
NULL
};
/* Some evil camera fill in the ImageDescription or UserComment fields
with useless fluff. Try to filter these out, so they do not show up
as comments */
......@@ -525,6 +531,7 @@ set_attributes_from_tagsets (GFileInfo *info)
set_attribute_from_tagset (info, "general::location", _LOCATION_TAG_NAMES);
set_string_list_attribute_from_tagset (info, "general::tags", _KEYWORDS_TAG_NAMES);
set_attribute_from_tagset (info, "general::rating", _RATING_TAG_NAMES);
set_attribute_from_tagset (info, "Embedded::Photo::DateTimeOriginal", _ORIGINAL_DATE_TAG_NAMES);
set_attribute_from_tagset (info, "Embedded::Image::Orientation", _ORIENTATION_TAG_NAMES);
}
......
......@@ -34,6 +34,7 @@ extern const char *_DESCRIPTION_TAG_NAMES[];
extern const char *_TITLE_TAG_NAMES[];
extern const char *_LOCATION_TAG_NAMES[];
extern const char *_KEYWORDS_TAG_NAMES[];
extern const char *_RATING_TAG_NAMES[];
gboolean exiv2_read_metadata_from_file (GFile *file,
GFileInfo *info,
......
......@@ -229,6 +229,18 @@ gth_metadata_provider_exiv2_write (GthMetadataProvider *base,
g_file_info_remove_attribute (file_data->info, _KEYWORDS_TAG_NAMES[i]);
}
metadata = g_file_info_get_attribute_object (file_data->info, "general::rating");
if (metadata != NULL) {
if (GTH_IS_METADATA (metadata))
g_object_set (metadata, "value-type", NULL, NULL);
for (i = 0; _RATING_TAG_NAMES[i] != NULL; i++)
g_file_info_set_attribute_object (file_data->info, _RATING_TAG_NAMES[i], metadata);
}
else {
for (i = 0; _RATING_TAG_NAMES[i] != NULL; i++)
g_file_info_remove_attribute (file_data->info, _RATING_TAG_NAMES[i]);
}
metadata = g_file_info_get_attribute_object (file_data->info, "general::datetime");
if (metadata != NULL) {
GthMetadata *xmp_metadata = NULL;
......
......@@ -152,6 +152,7 @@ GthMetadataInfo exiv2_metadata_info[] = {
{ "Xmp::iptc::Location", NULL, "Xmp::Embedded", 0, "XmpText", GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
{ "Xmp::iptc::Keywords", NULL, "Xmp::Embedded", 0, "XmpBag", GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
{ "Xmp::exif::DateTimeOriginal", NULL, "Xmp::Embedded", 0, "XmpText", GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
{ "Xmp::xmp::Rating", NULL, "Xmp::Embedded", 0, "XmpText", GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
{ "Iptc::Application2::Headline", NULL, "Iptc", 1, "String", GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
{ "Iptc::Application2::Caption", NULL, "Iptc", 2, "String", GTH_METADATA_ALLOW_IN_PROPERTIES_VIEW },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment