[tracker/tracker-0.8] tracker-extract-pdf: set nfo:isContentEncrypted for encrypted docs.



commit 1df919e2c9ce1a30f545d445714e4018674f93ca
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Apr 20 13:29:54 2010 +0200

    tracker-extract-pdf: set nfo:isContentEncrypted for encrypted docs.

 src/tracker-extract/tracker-extract-pdf.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 2bef783..6db5aee 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -314,11 +314,20 @@ extract_pdf (const gchar          *uri,
 	document = poppler_document_new_from_file (uri, NULL, &error);
 
 	if (error) {
-		g_warning ("Couldn't create PopplerDocument from uri:'%s', %s",
-		           uri,
-		           error->message ? error->message : "no error given");
-		g_error_free (error);
+		if (error->code == POPPLER_ERROR_ENCRYPTED) {
+			tracker_sparql_builder_predicate (metadata, "a");
+			tracker_sparql_builder_object (metadata, "nfo:PaginatedTextDocument");
+
+			tracker_sparql_builder_predicate (metadata, "nfo:isContentEncrypted");
+			tracker_sparql_builder_object_boolean (metadata, TRUE);
+			return;
+		} else {
+			g_warning ("Couldn't create PopplerDocument from uri:'%s', %s",
+			           uri,
+			           error->message ? error->message : "no error given");
+		}
 
+		g_error_free (error);
 		return;
 	}
 



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