[grilo-plugins] tracker: Use new "title-from-filename" property
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] tracker: Use new "title-from-filename" property
- Date: Fri, 28 Mar 2014 09:26:12 +0000 (UTC)
commit 4ab87ad07257663d650b9a467d65a51da5d95fd6
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jan 28 01:50:47 2014 +0100
tracker: Use new "title-from-filename" property
https://bugzilla.gnome.org/show_bug.cgi?id=706877
src/tracker/grl-tracker-utils.c | 42 +++++++++++++++++++++++++++++++-------
1 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/src/tracker/grl-tracker-utils.c b/src/tracker/grl-tracker-utils.c
index 3eb2efb..7c36f23 100644
--- a/src/tracker/grl-tracker-utils.c
+++ b/src/tracker/grl-tracker-utils.c
@@ -90,6 +90,30 @@ set_date (TrackerSparqlCursor *cursor,
}
}
+static void
+set_title_from_filename (TrackerSparqlCursor *cursor,
+ gint column,
+ GrlMedia *media,
+ GrlKeyID key)
+{
+ const gchar *str = tracker_sparql_cursor_get_string (cursor, column, NULL);
+ if (key == GRL_METADATA_KEY_TITLE) {
+ grl_data_set_boolean (GRL_DATA (media), GRL_METADATA_KEY_TITLE_FROM_FILENAME, TRUE);
+ grl_media_set_title (media, str);
+ }
+}
+
+static void
+set_title (TrackerSparqlCursor *cursor,
+ gint column,
+ GrlMedia *media,
+ GrlKeyID key)
+{
+ const gchar *str = tracker_sparql_cursor_get_string (cursor, column, NULL);
+ grl_data_set_boolean (GRL_DATA (media), GRL_METADATA_KEY_TITLE_FROM_FILENAME, FALSE);
+ grl_media_set_title (media, str);
+}
+
static tracker_grl_sparql_t *
insert_key_mapping (GrlKeyID grl_key,
const gchar *sparql_key_attr,
@@ -243,15 +267,17 @@ grl_tracker_setup_key_mappings (void)
"nie:url(?urn)",
"file");
- insert_key_mapping (GRL_METADATA_KEY_TITLE,
- "nie:title",
- "nie:title(?urn)",
- "audio");
+ insert_key_mapping_with_setter (GRL_METADATA_KEY_TITLE,
+ "nie:title",
+ "nie:title(?urn)",
+ "audio",
+ set_title);
- insert_key_mapping (GRL_METADATA_KEY_TITLE,
- "nfo:fileName",
- "nfo:fileName(?urn)",
- "file");
+ insert_key_mapping_with_setter (GRL_METADATA_KEY_TITLE,
+ "nfo:fileName",
+ "nfo:fileName(?urn)",
+ "file",
+ set_title_from_filename);
insert_key_mapping (GRL_METADATA_KEY_URL,
"nie:url",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]