Mercurial > geeqie
comparison src/metadata.c @ 1219:86fcbd0fcb7b
added change notification to bar_info.c
author | nadvornik |
---|---|
date | Tue, 23 Dec 2008 20:53:44 +0000 |
parents | 46e4fda574dd |
children | a0c249bcc4ff |
comparison
equal
deleted
inserted
replaced
1218:46e4fda574dd | 1219:86fcbd0fcb7b |
---|---|
544 * Exiv2 handles Iptc keywords as multiple entries with the | 544 * Exiv2 handles Iptc keywords as multiple entries with the |
545 * same key, thus exif_get_item returns only the first keyword | 545 * same key, thus exif_get_item returns only the first keyword |
546 * and the only way to get all keywords is to iterate through | 546 * and the only way to get all keywords is to iterate through |
547 * the item list. | 547 * the item list. |
548 */ | 548 */ |
549 for (item = exif_get_first_item(exif); | 549 /* Read IPTC keywords only if there are no XMP keywords |
550 item; | 550 * IPTC does not have standard charset, thus the encoding may differ |
551 item = exif_get_next_item(exif)) | 551 * from XMP and keyword merging is not reliable. |
552 { | 552 */ |
553 guint tag; | 553 if (!*keywords) |
554 | 554 { |
555 tag = exif_item_get_tag_id(item); | 555 for (item = exif_get_first_item(exif); |
556 if (tag == 0x0019) | 556 item; |
557 item = exif_get_next_item(exif)) | |
557 { | 558 { |
558 gchar *tag_name = exif_item_get_tag_name(item); | 559 guint tag; |
559 | 560 |
560 if (strcmp(tag_name, "Iptc.Application2.Keywords") == 0) | 561 tag = exif_item_get_tag_id(item); |
562 if (tag == 0x0019) | |
561 { | 563 { |
562 gchar *kw; | 564 gchar *tag_name = exif_item_get_tag_name(item); |
563 gchar *utf8_kw; | 565 |
564 | 566 if (strcmp(tag_name, "Iptc.Application2.Keywords") == 0) |
565 kw = exif_item_get_data_as_text(item); | 567 { |
566 if (!kw) continue; | 568 gchar *kw; |
567 | 569 gchar *utf8_kw; |
568 utf8_kw = utf8_validate_or_convert(kw); | 570 |
569 *keywords = g_list_append(*keywords, (gpointer) utf8_kw); | 571 kw = exif_item_get_data_as_text(item); |
570 g_free(kw); | 572 if (!kw) continue; |
573 | |
574 utf8_kw = utf8_validate_or_convert(kw); | |
575 *keywords = g_list_append(*keywords, (gpointer) utf8_kw); | |
576 g_free(kw); | |
577 } | |
578 g_free(tag_name); | |
571 } | 579 } |
572 g_free(tag_name); | |
573 } | 580 } |
574 } | 581 } |
575 } | 582 } |
576 | 583 |
577 exif_free_fd(fd, exif); | 584 exif_free_fd(fd, exif); |