tracker r2889 - in trunk: . data/services src/tracker-extract src/tracker-indexer src/trackerd



Author: ifrade
Date: Fri Feb  6 14:40:28 2009
New Revision: 2889
URL: http://svn.gnome.org/viewvc/tracker?rev=2889&view=rev

Log:
Added duration attibute for playlist and handle correctly duration on update

Modified:
   trunk/ChangeLog
   trunk/data/services/default.service
   trunk/data/services/playlist.metadata
   trunk/src/tracker-extract/tracker-extract-playlist.c
   trunk/src/tracker-indexer/tracker-indexer.c
   trunk/src/trackerd/tracker-metadata.c

Modified: trunk/data/services/default.service
==============================================================================
--- trunk/data/services/default.service	(original)
+++ trunk/data/services/default.service	Fri Feb  6 14:40:28 2009
@@ -310,8 +310,9 @@
 Parent=Files
 PropertyPrefix=Playlist
 Mimes=audio/x-mpegurl;audio/mpegurl;audio/x-scpls;audio/x-pn-realaudio;application/ram;application/vnd.ms-wpl;application/smil;audio/x-ms-asx;audio/x-pn-realaudio-plugin;
-KeyMetadata1=Playlist:TotalLength
+KeyMetadata1=Playlist:Duration
 KeyMetadata2=Playlist:Songs
+KeyMetadata3=Playlist:ValidDuration
 HasMetadata=true
 HasFullText=false
 HasThumbs=false

Modified: trunk/data/services/playlist.metadata
==============================================================================
--- trunk/data/services/playlist.metadata	(original)
+++ trunk/data/services/playlist.metadata	Fri Feb  6 14:40:28 2009
@@ -1,12 +1,11 @@
-[Playlist:TotalLength]
-DisplayName=Length
+[Playlist:Duration]
+DisplayName=Duration
 Description=Total length of songs in the playlist in seconds
 DataType=integer
 Weight=1
-Embedded=false
+Embedded=true
 Filtered=false
 
-
 [Playlist:Songs]
 DisplayName=Songs
 Description=Numbers of tracks in the playlist
@@ -21,3 +20,11 @@
 Weight=10
 Filtered=false
 Embedded=false
+
+[Playlist:ValidDuration]
+DisplayName=Valid duration
+Description=Duration is up to date
+DataType=integer
+Weight=1
+Filtered=false
+Embedded=true

Modified: trunk/src/tracker-extract/tracker-extract-playlist.c
==============================================================================
--- trunk/src/tracker-extract/tracker-extract-playlist.c	(original)
+++ trunk/src/tracker-extract/tracker-extract-playlist.c	Fri Feb  6 14:40:28 2009
@@ -35,7 +35,11 @@
 #include <totem-pl-parser.h>
 
 #define PLAYLIST_PROPERTY_NO_TRACKS "Playlist:Songs"
-#define PLAYLIST_PROPERTY_DURATION  "Playlist:TotalLength"
+#define PLAYLIST_PROPERTY_DURATION  "Playlist:Duration"
+#define PLAYLIST_PROPERTY_CALCULATED "Playlist:ValidDuration"
+
+#define PLAYLIST_DEFAULT_NO_TRACKS 0
+#define PLAYLIST_DEFAULT_DURATION 0 
 
 typedef struct {
 	gint        track_counter;
@@ -112,8 +116,8 @@
         case TOTEM_PL_PARSER_RESULT_IGNORED:
         case TOTEM_PL_PARSER_RESULT_ERROR:
         case TOTEM_PL_PARSER_RESULT_UNHANDLED:
-		data.total_time = 0;
-		data.track_counter = 0;
+		data.total_time = PLAYLIST_DEFAULT_NO_TRACKS;
+		data.track_counter = PLAYLIST_DEFAULT_DURATION;
                 break;
         default:
                 g_warning ("Undefined result in totem-plparser");
@@ -126,7 +130,9 @@
 	g_hash_table_insert (metadata, 
 			     g_strdup (PLAYLIST_PROPERTY_NO_TRACKS), 
 			     tracker_escape_metadata_printf ("%d", data.track_counter));
-
+	g_hash_table_insert (metadata,
+			     g_strdup (PLAYLIST_PROPERTY_CALCULATED),
+			     g_strdup (data.total_time == 0 ? "0" : "1"));
 	g_free (proper_filename);
         g_object_unref (pl);
 }

Modified: trunk/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- trunk/src/tracker-indexer/tracker-indexer.c	(original)
+++ trunk/src/tracker-indexer/tracker-indexer.c	Fri Feb  6 14:40:28 2009
@@ -2000,15 +2000,6 @@
 		return FALSE;
 	}
 
-	if (tracker_field_get_embedded (field)) {
-		g_set_error (error,
-			     g_quark_from_string (TRACKER_INDEXER_ERROR),
-			     TRACKER_INDEXER_ERROR_CODE,
-			     "Field type: '%s' is embedded and not writable",
-			     property);
-		return FALSE;
-	}
-
 	len = g_strv_length (values);
 
 	if (!tracker_field_get_multiple_values (field) && len > 1) {

Modified: trunk/src/trackerd/tracker-metadata.c
==============================================================================
--- trunk/src/trackerd/tracker-metadata.c	(original)
+++ trunk/src/trackerd/tracker-metadata.c	Fri Feb  6 14:40:28 2009
@@ -291,16 +291,6 @@
 			return;
 		}
 
-		if (tracker_field_get_embedded (field_def)) {
-			tracker_dbus_request_failed (request_id,
-						     &actual_error,
-						     "Metadata field '%s' cannot be overwritten (is embedded)",
-						     keys[i]);
-			dbus_g_method_return_error (context, actual_error);
-			g_error_free (actual_error);
-			return;
-		}
-
 		tmp_values = tracker_string_to_string_list (values[i]);
 		len = g_strv_length (tmp_values);
 		g_strfreev (tmp_values);



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