[grilo-plugins/wip/jfelder/tracker3-empty-values: 1/4] tracker3: Do not writeback empty values
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/wip/jfelder/tracker3-empty-values: 1/4] tracker3: Do not writeback empty values
- Date: Fri, 6 Aug 2021 15:48:53 +0000 (UTC)
commit b9edc29ec177534fcec5d66999976358fb38b503
Author: Jean Felder <jfelder src gnome org>
Date: Thu Aug 5 17:45:54 2021 +0200
tracker3: Do not writeback empty values
When setting properties that can have multiple values, it iterates
until a null value is found. This last value should not be used to
create a Tracker resource.
src/tracker3/grl-tracker-utils.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/tracker3/grl-tracker-utils.c b/src/tracker3/grl-tracker-utils.c
index 53aef814..edddc2b7 100644
--- a/src/tracker3/grl-tracker-utils.c
+++ b/src/tracker3/grl-tracker-utils.c
@@ -663,10 +663,13 @@ grl_tracker_build_resource_from_media (GrlMedia *media, GList *keys)
} else if (l->data == GRLKEYID_TO_POINTER (GRL_METADATA_KEY_ARTIST)) {
TrackerResource *artist;
const gchar *artist_name;
- gint i;
+ gint i = 0;
- for (i = 0; artist_name != NULL; i++) {
+ while (TRUE) {
artist_name = grl_media_get_artist_nth (media, i);
+ if (!artist_name)
+ break;
+
artist = ensure_resource_for_property (resource, "nmm:artist", TRUE);
tracker_resource_set_string (artist, "nmm:artistName", artist_name);
@@ -681,26 +684,35 @@ grl_tracker_build_resource_from_media (GrlMedia *media, GList *keys)
mb_artist_id);
}
}
+ i++;
}
} else if (l->data == GRLKEYID_TO_POINTER (GRL_METADATA_KEY_AUTHOR)) {
TrackerResource *artist;
const gchar *artist_name;
- gint i;
+ gint i = 0;
- for (i = 0; artist_name != NULL; i++) {
+ while (TRUE) {
artist_name = grl_media_get_artist_nth (media, i);
+ if (!artist_name)
+ break;
+
artist = ensure_resource_for_property (resource, "nmm:artist", TRUE);
tracker_resource_set_string (artist, "nmm:artistName", artist_name);
+ i++;
}
} else if (l->data == GRLKEYID_TO_POINTER (GRL_METADATA_KEY_COMPOSER)) {
TrackerResource *composer;
const gchar *composer_name;
- gint i;
+ gint i = 0;
- for (i = 0; composer_name != NULL; i++) {
+ while (TRUE) {
composer_name = grl_media_get_composer_nth (media, i);
+ if (!composer_name)
+ break;
+
composer = ensure_resource_for_property (resource, "nmm:composer", TRUE);
tracker_resource_set_string (composer, "nmm:artistName", composer_name);
+ i++;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]