tracker r3046 - in trunk: . src/tracker-extract
- From: mottela svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r3046 - in trunk: . src/tracker-extract
- Date: Tue, 10 Mar 2009 18:36:05 +0000 (UTC)
Author: mottela
Date: Tue Mar 10 18:36:05 2009
New Revision: 3046
URL: http://svn.gnome.org/viewvc/tracker?rev=3046&view=rev
Log:
Remove the dummy empty strings for unknown values as they are no longer needed
Modified:
trunk/ChangeLog
trunk/src/tracker-extract/tracker-extract-gstreamer-helix.c
trunk/src/tracker-extract/tracker-extract-mp3.c
trunk/src/tracker-extract/tracker-main.h
Modified: trunk/src/tracker-extract/tracker-extract-gstreamer-helix.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-gstreamer-helix.c (original)
+++ trunk/src/tracker-extract/tracker-extract-gstreamer-helix.c Tue Mar 10 18:36:05 2009
@@ -827,37 +827,52 @@
/* Check that we have the minimum data. FIXME We should not need to do this */
- if (type==EXTRACT_MIME_AUDIO) {
- if (!g_hash_table_lookup (metadata, "Audio:Title")) {
- g_hash_table_insert (metadata, g_strdup ("Audio:Title"), g_strdup (METADATA_UNKNOWN));
- }
-
- if (!g_hash_table_lookup (metadata, "Audio:Album")) {
- g_hash_table_insert (metadata, g_strdup ("Audio:Album"), g_strdup (METADATA_UNKNOWN));
- }
-
- if (!g_hash_table_lookup (metadata, "Audio:Artist")) {
- g_hash_table_insert (metadata, g_strdup ("Audio:Artist"), g_strdup (METADATA_UNKNOWN));
+ if (type == EXTRACT_MIME_IMAGE) {
+ if (!g_hash_table_lookup (metadata, "Image:Date")) {
+ struct stat st;
+
+ if (g_lstat (uri, &st) >= 0) {
+ gchar *date;
+
+ date = tracker_date_to_string (st.st_mtime);
+
+ g_hash_table_insert (metadata,
+ g_strdup ("Image:Date"),
+ tracker_escape_metadata (date));
+ g_free (date);
+ }
}
-
- if (!g_hash_table_lookup (metadata, "Audio:Genre")) {
- g_hash_table_insert (metadata, g_strdup ("Audio:Genre"), g_strdup (METADATA_UNKNOWN));
- }
-
- if (!g_hash_table_lookup (metadata, "Audio:PlayCount")) {
- g_hash_table_insert (metadata, g_strdup ("Audio:PlayCount"), g_strdup ("0"));
- }
- } else if (type==EXTRACT_MIME_VIDEO) {
+ } else if (type == EXTRACT_MIME_VIDEO) {
if (!g_hash_table_lookup (metadata, "Video:Title")) {
- g_hash_table_insert (metadata, g_strdup ("Video:Title"), g_strdup (METADATA_UNKNOWN));
- }
-
- if (!g_hash_table_lookup (metadata, "Video:Author")) {
- g_hash_table_insert (metadata, g_strdup ("Video:Author"), g_strdup (METADATA_UNKNOWN));
+ 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, "_", ' ');
+
+ g_hash_table_insert (metadata,
+ g_strdup ("Video:Title"),
+ tracker_escape_metadata (title));
+ g_free (title);
}
-
- if (!g_hash_table_lookup (metadata, "Video:PlayCount")) {
- g_hash_table_insert (metadata, g_strdup ("Video:PlayCount"), g_strdup ("0"));
+ } else if (type == EXTRACT_MIME_AUDIO) {
+ if (!g_hash_table_lookup (metadata, "Audio: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, "_", ' ');
+
+ g_hash_table_insert (metadata,
+ g_strdup ("Audio:Title"),
+ tracker_escape_metadata (title));
+ g_free (title);
}
}
Modified: trunk/src/tracker-extract/tracker-extract-mp3.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-mp3.c (original)
+++ trunk/src/tracker-extract/tracker-extract-mp3.c Tue Mar 10 18:36:05 2009
@@ -1619,37 +1619,6 @@
g_free (title);
}
- if (!g_hash_table_lookup (metadata, "Audio:Album")) {
- g_hash_table_insert (metadata,
- g_strdup ("Audio:Album"),
- g_strdup (METADATA_UNKNOWN));
- }
-
- if (!g_hash_table_lookup (metadata, "Audio:Artist")) {
- g_hash_table_insert (metadata,
- g_strdup ("Audio:Artist"),
- g_strdup (METADATA_UNKNOWN));
- }
-
- if (!g_hash_table_lookup (metadata, "Audio:Genre")) {
- g_hash_table_insert (metadata,
- g_strdup ("Audio:Genre"),
- g_strdup (METADATA_UNKNOWN));
- }
-
- if (!g_hash_table_lookup (metadata, "Audio:PlayCount")) {
- g_hash_table_insert (metadata,
- g_strdup ("Audio:PlayCount"),
- g_strdup ("0"));
- }
-
- if (!g_hash_table_lookup (metadata, "Audio:Duration")) {
- g_hash_table_insert (metadata,
- g_strdup ("Audio:Duration"),
- g_strdup ("0"));
- }
-
-
#ifndef G_OS_WIN32
munmap (buffer, size);
#endif
Modified: trunk/src/tracker-extract/tracker-main.h
==============================================================================
--- trunk/src/tracker-extract/tracker-main.h (original)
+++ trunk/src/tracker-extract/tracker-main.h Tue Mar 10 18:36:05 2009
@@ -28,13 +28,6 @@
G_BEGIN_DECLS
-/* FIXME: We use this to say that we don't actually have any metadata
- * for this keyword. This is bad because it means we have to string
- * check every value returned in clients that use the Tracker API.
- * This will be fixed in due course after January some time, -mr.
- */
-#define METADATA_UNKNOWN ""
-
typedef struct TrackerExtractData TrackerExtractData;
typedef TrackerExtractData * (*TrackerExtractDataFunc)(void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]