[tracker/tracker-store] tracker-extract: Do not scan populated statement list
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-store] tracker-extract: Do not scan populated statement list
- Date: Fri, 26 Jun 2009 09:49:07 +0000 (UTC)
commit 69063c0d29505a63c20f9b48344b72c65be44092
Author: Jürg Billeter <j bitron ch>
Date: Fri Jun 26 11:46:03 2009 +0200
tracker-extract: Do not scan populated statement list
Preparation for switch to SPARQL Update.
src/tracker-extract/tracker-extract-gstreamer.c | 43 ++---------------------
src/tracker-extract/tracker-extract-mp3.c | 26 +++++++++++++-
2 files changed, 27 insertions(+), 42 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 21f4a6f..3a9451c 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -872,7 +872,7 @@ tracker_extract_gstreamer (const gchar *uri,
if (!extractor->pipeline) {
g_warning ("No valid pipeline for uri %s", uri);
- goto fail;
+ return;
}
extractor->bus = gst_pipeline_get_bus (GST_PIPELINE (extractor->pipeline));
@@ -880,12 +880,12 @@ tracker_extract_gstreamer (const gchar *uri,
if (use_tagreadbin) {
if (!poll_for_ready (extractor, GST_STATE_PLAYING, FALSE, TRUE)) {
g_warning ("Error running tagreadbin");
- goto fail;
+ return;
}
} else {
if (!poll_for_ready (extractor, GST_STATE_PAUSED, TRUE, FALSE)) {
g_warning ("Error running decodebin");
- goto fail;
+ return;
}
add_stream_tags(extractor);
@@ -932,43 +932,6 @@ tracker_extract_gstreamer (const gchar *uri,
gst_object_unref (GST_OBJECT (extractor->pipeline));
g_slice_free (MetadataExtractor, extractor);
-
-fail:
- if (type == EXTRACT_MIME_IMAGE) {
- /* We fallback to the file's modified time for the
- * "Image:Date" metadata if it doesn't exist.
- *
- * FIXME: This shouldn't be necessary.
- */
- if (!tracker_statement_list_find (metadata, uri, NIE_PREFIX "contentCreated")) {
- gchar *date;
- guint64 mtime;
-
- mtime = tracker_file_get_mtime (uri);
- date = tracker_date_to_string ((time_t) mtime);
-
- tracker_statement_list_insert (metadata, uri,
- NIE_PREFIX "contentCreated",
- date);
- g_free (date);
- }
- }
-
- if (!tracker_statement_list_find (metadata, uri, NIE_PREFIX "title")) {
- gchar *basename = g_filename_display_basename (uri);
- gchar **parts = g_strsplit (basename, ".", -1);
- gchar *title = g_strdup (parts[0]);
-
- g_strfreev (parts);
- g_free (basename);
-
- title = g_strdelimit (title, "_", ' ');
-
- tracker_statement_list_insert (metadata, uri,
- NIE_PREFIX "title",
- title);
- g_free (title);
- }
}
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index d22b6d6..580ae62 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -99,6 +99,8 @@ typedef struct {
guint32 duration;
+ gchar *title;
+
unsigned char *albumartdata;
size_t albumartsize;
gchar *albumartmime;
@@ -902,6 +904,11 @@ get_id3v24_tags (const gchar *data,
/* prefer ID3v2 tag over ID3v1 tag */
g_free (*tmap[i].nullify);
*tmap[i].nullify = NULL;
+
+ /* keep title around for albumart */
+ if (tmap[i].nullify == &filedata->id3v1_info->title) {
+ filedata->title = g_strdup (word);
+ }
}
if (tmap[i].urn) {
gchar *canonical_uri = tmap[i].urn[0]!=':'?tracker_uri_printf_escaped ("urn:%s:%s", tmap[i].urn, word):g_strdup(tmap[i].urn);
@@ -1163,6 +1170,11 @@ get_id3v23_tags (const gchar *data,
/* prefer ID3v2 tag over ID3v1 tag */
g_free (*tmap[i].nullify);
*tmap[i].nullify = NULL;
+
+ /* keep title around for albumart */
+ if (tmap[i].nullify == &filedata->id3v1_info->title) {
+ filedata->title = g_strdup (word);
+ }
}
if (tmap[i].urn) {
gchar *canonical_uri = tmap[i].urn[0]!=':'?tracker_uri_printf_escaped ("urn:%s:%s", tmap[i].urn, word):g_strdup(tmap[i].urn);
@@ -1404,6 +1416,11 @@ get_id3v20_tags (const gchar *data,
/* prefer ID3v2 tag over ID3v1 tag */
g_free (*tmap[i].nullify);
*tmap[i].nullify = NULL;
+
+ /* keep title around for albumart */
+ if (tmap[i].nullify == &filedata->id3v1_info->title) {
+ filedata->title = g_strdup (word);
+ }
}
if (tmap[i].urn) {
gchar *canonical_uri = tmap[i].urn[0]!=':'?tracker_uri_printf_escaped ("urn:%s:%s", tmap[i].urn, word):g_strdup(tmap[i].urn);
@@ -1688,6 +1705,7 @@ extract_mp3 (const gchar *uri,
filedata.size = 0;
filedata.id3v2_size = 0;
filedata.duration = 0;
+ filedata.title = NULL;
filedata.albumartdata = NULL;
filedata.albumartmime = NULL;
filedata.albumartsize = 0;
@@ -1761,6 +1779,9 @@ extract_mp3 (const gchar *uri,
tracker_statement_list_insert (metadata, uri,
NIE_PREFIX "title",
info.title);
+
+ /* keep title around for albumart */
+ filedata.title = g_strdup (info.title);
}
if (!tracker_is_empty_string (info.artist)) {
@@ -1818,16 +1839,17 @@ extract_mp3 (const gchar *uri,
#ifdef HAVE_GDKPIXBUF
tracker_process_albumart (filedata.albumartdata, filedata.albumartsize, filedata.albumartmime,
/* tracker_statement_list_find (metadata, NMM_PREFIX "performer") */ NULL,
- tracker_statement_list_find (metadata, uri, NIE_PREFIX "title"), "-1",
+ filedata.title, "-1",
filename);
#else
tracker_process_albumart (NULL, 0, NULL,
/* tracker_statement_list_find (metadata, NMM_PREFIX "performer") */ NULL,
- tracker_statement_list_find (metadata, uri, NIE_PREFIX "title"), "-1",
+ filedata.title, "-1",
filename);
#endif /* HAVE_GDKPIXBUF */
+ g_free (filedata.title);
g_free (filedata.albumartdata);
g_free (filedata.albumartmime);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]