[tracker] Fixes NB#173206, use nfo:device and merge make and model correct for videos



commit bf1cc140b35d87a3a0ac11c9b39f87e3b842ff84
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Jun 8 16:45:30 2010 +0300

    Fixes NB#173206, use nfo:device and merge make and model correct for videos

 docs/ontologies/nie/explanation.xml                |    2 +-
 src/libtracker-extract/tracker-xmp.c               |    2 +-
 src/miners/flickr/tracker-miner-flickr.vala        |    2 +-
 src/tracker-extract/tracker-extract-gif.c          |    2 +-
 src/tracker-extract/tracker-extract-gstreamer.c    |   27 ++++++++++++++++++-
 src/tracker-extract/tracker-extract-jpeg.c         |    2 +-
 src/tracker-extract/tracker-extract-pdf.cpp        |    2 +-
 src/tracker-extract/tracker-extract-png.c          |    2 +-
 src/tracker-extract/tracker-extract-tiff.c         |    2 +-
 tests/functional-tests/metadata_extraction_tc.py   |    2 +-
 tests/functional-tests/performance-tc.py           |   12 ++++----
 tests/functional-tests/writeback-tc.py             |   12 ++++----
 tests/tracker-writeback/01-writeback.py            |    2 +-
 utils/data-generators/cc/nmm.py                    |    2 +-
 utils/data-generators/deprecated/generate_Image.py |    2 +-
 utils/services/file-class.cache.test               |    2 +-
 16 files changed, 50 insertions(+), 27 deletions(-)
---
diff --git a/docs/ontologies/nie/explanation.xml b/docs/ontologies/nie/explanation.xml
index 1bfa1e8..2eaa050 100644
--- a/docs/ontologies/nie/explanation.xml
+++ b/docs/ontologies/nie/explanation.xml
@@ -136,7 +136,7 @@ its album).
 	 nfo:height 36 ;
          nmm:flash &lt;nmm:flash-off&gt;;
          nmm:whiteBalance &lt;nmm:white-balance-automatic&gt; ;
-         nmm:camera "Tracknon N900" ;
+         nfo:device "Tracknon N900" ;
 
          # Properties from nfo:FileDataObject
          nfo:fileSize 12341234 ;
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index d8b12a0..e146aba 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -752,7 +752,7 @@ tracker_xmp_apply (TrackerSparqlBuilder *metadata,
 	if (data->make || data->model) {
 		gchar *final_camera = tracker_merge_const (" ", 2, data->make, data->model);
 
-		tracker_sparql_builder_predicate (metadata, "nmm:camera");
+		tracker_sparql_builder_predicate (metadata, "nfo:device");
 		tracker_sparql_builder_object_unvalidated (metadata, final_camera);
 		g_free (final_camera);
 	}
diff --git a/src/miners/flickr/tracker-miner-flickr.vala b/src/miners/flickr/tracker-miner-flickr.vala
index 2d1ef7e..96a766e 100644
--- a/src/miners/flickr/tracker-miner-flickr.vala
+++ b/src/miners/flickr/tracker-miner-flickr.vala
@@ -364,7 +364,7 @@ public class MinerFlickr : Tracker.MinerWeb {
 
 			switch (exif_node.get_attr ("tag").to_int ()) {
 				case ExifTag.CAMERA:
-					update_triple_string (builder, graph, urn, "nmm:camera", exif_value);
+					update_triple_string (builder, graph, urn, "nfo:device", exif_value);
 					break;
 				case ExifTag.FLASH:
 					update_triple_object (builder, graph, urn, "nmm:flash", exif_value.to_int ()%2 == 1 ? "nmm:flash-on" : "nmm:flash-off");
diff --git a/src/tracker-extract/tracker-extract-gif.c b/src/tracker-extract/tracker-extract-gif.c
index cf886a7..329c0ef 100644
--- a/src/tracker-extract/tracker-extract-gif.c
+++ b/src/tracker-extract/tracker-extract-gif.c
@@ -236,7 +236,7 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 	}
 
 	if (md.camera) {
-		tracker_sparql_builder_predicate (metadata, "nmm:camera");
+		tracker_sparql_builder_predicate (metadata, "nfo:device");
 		tracker_sparql_builder_object_unvalidated (metadata, md.camera);
 	}
 
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 46cbd31..8c719c7 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -79,6 +79,10 @@ long long int llroundl(long double x);
 #define GST_TAG_DEVICE_MODEL "device-model"
 #endif
 
+#ifndef GST_TAG_DEVICE_MAKE
+#define GST_TAG_DEVICE_MAKE "device-make"
+#endif
+
 
 typedef enum {
 	EXTRACT_MIME_AUDIO,
@@ -492,7 +496,7 @@ extract_metadata (MetadataExtractor      *extractor,
                   gchar                 **scount)
 {
 	const gchar *temp;
-	gchar *s;
+	gchar *s, *make = NULL, *model = NULL, *make_model = NULL;
 	gboolean ret;
 	gint count;
 	gboolean needs_audio = FALSE;
@@ -748,7 +752,26 @@ extract_metadata (MetadataExtractor      *extractor,
 		add_string_gst_tag (metadata, uri, "dc:coverage", extractor->tagcache, GST_TAG_LOCATION);
 		add_y_date_gst_tag (metadata, uri, "nie:contentCreated", extractor->tagcache, GST_TAG_DATE);
 		add_string_gst_tag (metadata, uri, "nie:comment", extractor->tagcache, GST_TAG_COMMENT);
-		add_string_gst_tag (metadata, uri, "nfo:device", extractor->tagcache, GST_TAG_DEVICE_MODEL);
+
+		gst_tag_list_get_string (extractor->tagcache, GST_TAG_DEVICE_MODEL, &model);
+		gst_tag_list_get_string (extractor->tagcache, GST_TAG_DEVICE_MAKE, &make);
+
+		if (make && model) {
+			make_model = tracker_merge_const (" ", 2, make, model);
+		} else if (make) {
+			make_model = g_strdup (make);
+		} else if (model) {
+			make_model = g_strdup (model);
+		}
+
+		if (make_model) {
+			tracker_sparql_builder_predicate (metadata, "nfo:device");
+			tracker_sparql_builder_object_unvalidated (metadata, make_model);
+			g_free (make_model);
+		}
+
+		g_free (make);
+		g_free (model);
 
 		if (extractor->is_content_encrypted) {
 			tracker_sparql_builder_predicate (metadata, "nfo:isContentEncrypted");
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index 354d038..9d23adb 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -392,7 +392,7 @@ extract_jpeg (const gchar          *uri,
 	g_ptr_array_free (keywords, TRUE);
 
 	if (md.camera) {
-		tracker_sparql_builder_predicate (metadata, "nmm:camera");
+		tracker_sparql_builder_predicate (metadata, "nfo:device");
 		tracker_sparql_builder_object_unvalidated (metadata, md.camera);
 	}
 
diff --git a/src/tracker-extract/tracker-extract-pdf.cpp b/src/tracker-extract/tracker-extract-pdf.cpp
index 700b54e..2488b49 100644
--- a/src/tracker-extract/tracker-extract-pdf.cpp
+++ b/src/tracker-extract/tracker-extract-pdf.cpp
@@ -633,7 +633,7 @@ extract_pdf (const gchar          *uri,
 					camera = g_strdup (xd->model);
 				}
 
-				tracker_sparql_builder_predicate (metadata, "nmm:camera");
+				tracker_sparql_builder_predicate (metadata, "nfo:device");
 				tracker_sparql_builder_object_unvalidated (metadata, camera);
 				g_free (camera);
 			}
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index 7ee717f..b08f7d2 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -276,7 +276,7 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 	}
 
 	if (md.camera) {
-		tracker_sparql_builder_predicate (metadata, "nmm:camera");
+		tracker_sparql_builder_predicate (metadata, "nfo:device");
 		tracker_sparql_builder_object_unvalidated (metadata, md.camera);
 	}
 
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 14cd9e3..ae09e3b 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -544,7 +544,7 @@ extract_tiff (const gchar          *uri,
 	g_ptr_array_free (keywords, TRUE);
 
 	if (md.camera) {
-		tracker_sparql_builder_predicate (metadata, "nmm:camera");
+		tracker_sparql_builder_predicate (metadata, "nfo:device");
 		tracker_sparql_builder_object_unvalidated (metadata, md.camera);
 	}
 
diff --git a/tests/functional-tests/metadata_extraction_tc.py b/tests/functional-tests/metadata_extraction_tc.py
index 74d1e93..7fbd817 100755
--- a/tests/functional-tests/metadata_extraction_tc.py
+++ b/tests/functional-tests/metadata_extraction_tc.py
@@ -618,7 +618,7 @@ class images(TrackerHelpers):
                                 if parm.rstrip() == 'Camera':
 					query = "SELECT ?value WHERE { \
 					?uid nie:url <%s>; \
-					nmm:camera ?value.}" %(file_uri)
+					nfo:device ?value.}" %(file_uri)
 					print query
 					results = self.query (query)
 					print results
diff --git a/tests/functional-tests/performance-tc.py b/tests/functional-tests/performance-tc.py
index c5560cb..72b4140 100644
--- a/tests/functional-tests/performance-tc.py
+++ b/tests/functional-tests/performance-tc.py
@@ -865,7 +865,7 @@ class gallery(TestUpdate):
 
 		query = "SELECT ?media WHERE { \
                      	?media a nfo:Visual; \
-                        nmm:camera 'NOKIA' }"
+                        nfo:device 'NOKIA' }"
 
 		start=time.time()
 
@@ -882,7 +882,7 @@ class gallery(TestUpdate):
 
 		query = "SELECT ?media WHERE { \
                      	?media a nfo:Visual; \
-                        nmm:camera 'NOKIA' } LIMIT 500"
+                        nfo:device 'NOKIA' } LIMIT 500"
 
 		start=time.time()
 
@@ -903,7 +903,7 @@ class gallery(TestUpdate):
 			nie:mimeType ?mime. \
 			OPTIONAL { ?image nfo:height ?height .}\
 			OPTIONAL { ?image nfo:width  ?width .}\
-			OPTIONAL { ?image nmm:camera ?camera .}\
+			OPTIONAL { ?image nfo:device ?camera .}\
 			OPTIONAL { ?image nmm:exposureTime ?exposuretime .}\
 			OPTIONAL { ?image nmm:fnumber ?fnumber .}\
 			OPTIONAL { ?image nmm:focalLength ?focallength .}} LIMIT 10000"
@@ -930,7 +930,7 @@ class gallery(TestUpdate):
 			nie:mimeType ?mime. \
 			OPTIONAL { ?image nfo:height ?height .}\
 			OPTIONAL { ?image nfo:width  ?width .}\
-			OPTIONAL { ?image nmm:camera ?camera .}\
+			OPTIONAL { ?image nfo:device ?camera .}\
 			OPTIONAL { ?image nmm:exposureTime ?exposuretime .}\
 			OPTIONAL { ?image nmm:fnumber ?fnumber .}\
 			OPTIONAL { ?image nmm:focalLength ?focallength .}} LIMIT 500"
@@ -971,7 +971,7 @@ class gallery(TestUpdate):
 		"""Querying all images """
 		"""simplified version of test_gallery_09 """
 
-		query = "SELECT nie:url(?image) nfo:height(?image) nfo:width(?image) nie:mimeType(?image) nmm:camera(?image) nmm:exposureTime(?image) nmm:fnumber(?image) nmm:focalLength(?image) WHERE { ?image a nmm:Photo . } limit 10000"
+		query = "SELECT nie:url(?image) nfo:height(?image) nfo:width(?image) nie:mimeType(?image) nfo:device(?image) nmm:exposureTime(?image) nmm:fnumber(?image) nmm:focalLength(?image) WHERE { ?image a nmm:Photo . } limit 10000"
 
 
 		start=time.time()
@@ -987,7 +987,7 @@ class gallery(TestUpdate):
 		"""Querying 500 images """
 		"""simplified version of test_gallery_10 """
 
-		query = "SELECT nie:url(?image) nfo:height(?image) nfo:width(?image) nie:mimeType(?image) nmm:camera(?image) nmm:exposureTime(?image) nmm:fnumber(?image) nmm:focalLength(?image) WHERE { ?image a nmm:Photo . } limit 500"
+		query = "SELECT nie:url(?image) nfo:height(?image) nfo:width(?image) nie:mimeType(?image) nfo:device(?image) nmm:exposureTime(?image) nmm:fnumber(?image) nmm:focalLength(?image) WHERE { ?image a nmm:Photo . } limit 500"
 
 
 		start=time.time()
diff --git a/tests/functional-tests/writeback-tc.py b/tests/functional-tests/writeback-tc.py
index 754c4b1..542f455 100644
--- a/tests/functional-tests/writeback-tc.py
+++ b/tests/functional-tests/writeback-tc.py
@@ -544,9 +544,9 @@ class writeback(TestWriteback):
 			Results = {}
 
                 	insert = """
-				DELETE {?file nmm:camera ?val }
-				WHERE { ?file nmm:camera ?val ;nie:url <%s> }
-				INSERT {?file nmm:camera 'test camera' }
+				DELETE {?file nfo:device ?val }
+				WHERE { ?file nfo:device ?val ;nie:url <%s> }
+				INSERT {?file nfo:device 'test camera' }
 				WHERE { ?file nie:url <%s> }
                 		""" %(uri, uri)
 			print insert
@@ -554,14 +554,14 @@ class writeback(TestWriteback):
 			self.loop.run()
 
                 	""" verify the inserted item """
-			result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nmm:camera')
+			result=commands.getoutput(tracker_ext + ' -f' +' ' + uri +' | grep nfo:device')
 			print result
                 	value=result.split()
-			if (result.find('nmm:camera')!=-1)  and (value[1]=='"test') and (value[2]=='camera"'):
+			if (result.find('nfo:device')!=-1)  and (value[1]=='"test') and (value[2]=='camera"'):
 				print "property is set"
                 	else:
 				print "property is NOT set"
-				Results[uri]='nmm:camera'
+				Results[uri]='nfo:device'
 
 			overallRes.append(Results)
                 for Result_dict in overallRes:
diff --git a/tests/tracker-writeback/01-writeback.py b/tests/tracker-writeback/01-writeback.py
index 58f63a6..9a75b37 100755
--- a/tests/tracker-writeback/01-writeback.py
+++ b/tests/tracker-writeback/01-writeback.py
@@ -69,7 +69,7 @@ class TestInsertion (unittest.TestCase):
                       nmm:exposureTime '1' ;
                       nmm:isoSpeed '1' ;
                       nmm:fnumber '1' ;
-                      nmm:camera 'Some Test Model' ;
+                      nfo:device 'Some Test Model' ;
                       nco:contributor [ a nco:Contact ;
                                         nco:fullname 'test_fullname_2' ] ;
                       nie:copyright 'test_copyright_1'
diff --git a/utils/data-generators/cc/nmm.py b/utils/data-generators/cc/nmm.py
index 3f20edb..7970e07 100644
--- a/utils/data-generators/cc/nmm.py
+++ b/utils/data-generators/cc/nmm.py
@@ -14,7 +14,7 @@ nmm_Photo = '''
     nfo:fileLastAccessed "%(photo_date)s";
     nfo:fileSize         "%(photo_size)s";
     nfo:fileName         "%(photo_filename)s" ;
-    nmm:camera           "%(photo_camera)s";
+    nfo:device           "%(photo_camera)s";
     nmm:exposureTime     "%(photo_exposure)s";
     nmm:fnumber          "%(photo_fnumber)s";
     nmm:focalLength      "%(photo_focal_length)s";
diff --git a/utils/data-generators/deprecated/generate_Image.py b/utils/data-generators/deprecated/generate_Image.py
index cc6bf2f..60b8131 100644
--- a/utils/data-generators/deprecated/generate_Image.py
+++ b/utils/data-generators/deprecated/generate_Image.py
@@ -59,7 +59,7 @@ for index in range(start_id, start_id + count1):
    f.write('\tnfo:fileName          "photo'+`index`+'.jpg";\n')
    if ((index-start_id)<(count1/2)):
 	 f.write ('\tnao:hasTag [a nao:Tag ; nao:prefLabel  "TEST"];\n')
-	 f.write('\tnmm:camera            "NOKIA";\n')
+	 f.write('\tnfo:device            "NOKIA";\n')
    f.write('\tnmm:exposureTime      "'+`index`+'";\n') 
    f.write('\tnmm:fnumber           "'+`(1 + (index % 20))`+'";\n')
    f.write('\tnmm:focalLength       "'+` (1 + (index % 500))`+'".\n')
diff --git a/utils/services/file-class.cache.test b/utils/services/file-class.cache.test
index 1810c5c..08e4576 100644
--- a/utils/services/file-class.cache.test
+++ b/utils/services/file-class.cache.test
@@ -312,7 +312,7 @@ nmm nmm:isContentEncrypted
 nmm nmm:skipCounter
 nmm nmm:ImageList
 nmm nmm:Photo
-nmm nmm:camera
+nmm nfo:device
 nmm nmm:exposureTime
 nmm nmm:Flash
 nmm nmm:flash-on



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]