rygel r364 - trunk/src/plugins/tracker
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r364 - trunk/src/plugins/tracker
- Date: Thu, 25 Dec 2008 11:59:15 +0000 (UTC)
Author: zeeshanak
Date: Thu Dec 25 11:59:15 2008
New Revision: 364
URL: http://svn.gnome.org/viewvc/rygel?rev=364&view=rev
Log:
Tracker items fetch metadata at contruction time.
Modified:
trunk/src/plugins/tracker/rygel-tracker-container.vala
trunk/src/plugins/tracker/rygel-tracker-image-item.vala
trunk/src/plugins/tracker/rygel-tracker-item.vala
trunk/src/plugins/tracker/rygel-tracker-music-item.vala
trunk/src/plugins/tracker/rygel-tracker-video-item.vala
Modified: trunk/src/plugins/tracker/rygel-tracker-container.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-container.vala (original)
+++ trunk/src/plugins/tracker/rygel-tracker-container.vala Thu Dec 25 11:59:15 2008
@@ -160,18 +160,20 @@
string path) {
MediaItem item;
- if (this.child_class == MediaItem.VIDEO_CLASS) {
- item = new TrackerVideoItem (path,
- path,
- this);
- } else if (this.child_class == MediaItem.IMAGE_CLASS) {
- item = new TrackerImageItem (path,
- path,
- this);
- } else {
- item = new TrackerMusicItem (path,
- path,
- this);
+ try {
+ if (this.child_class == MediaItem.VIDEO_CLASS) {
+ item = new TrackerVideoItem (path, path, this);
+ } else if (this.child_class == MediaItem.IMAGE_CLASS) {
+ item = new TrackerImageItem (path, path, this);
+ } else {
+ item = new TrackerMusicItem (path, path, this);
+ }
+ } catch (GLib.Error error) {
+ critical ("Failed to fetch item %s. Reason: %s",
+ item.id,
+ error.message);
+
+ return false;
}
try {
Modified: trunk/src/plugins/tracker/rygel-tracker-image-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-image-item.vala (original)
+++ trunk/src/plugins/tracker/rygel-tracker-image-item.vala Thu Dec 25 11:59:15 2008
@@ -33,9 +33,7 @@
public class Rygel.TrackerImageItem : TrackerItem {
public TrackerImageItem (string id,
string path,
- TrackerContainer parent) {
- base (id, path, parent);
-
+ TrackerContainer parent) throws GLib.Error {
keys = new string[] {"File:Name",
"File:Mime",
"Image:Title",
@@ -45,10 +43,11 @@
"Image:Album",
"Image:Date",
"DC:Date"};
+
+ base (id, path, parent);
}
- public override void serialize (DIDLLiteWriter didl_writer)
- throws GLib.Error {
+ public override void fetch_metadata () throws GLib.Error {
string[] values = null;
/* TODO: make this async */
@@ -84,8 +83,6 @@
this.author = values[3];
this.album = values[6];
this.uri = this.uri_from_path (path);
-
- base.serialize (didl_writer);
}
}
Modified: trunk/src/plugins/tracker/rygel-tracker-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-item.vala (original)
+++ trunk/src/plugins/tracker/rygel-tracker-item.vala Thu Dec 25 11:59:15 2008
@@ -38,11 +38,13 @@
public TrackerItem (string id,
string path,
- TrackerContainer parent) {
+ TrackerContainer parent) throws GLib.Error {
base (id, parent.id, "", parent.child_class, parent.streamer);
this.path = path;
this.parent = parent;
+
+ this.fetch_metadata ();
}
protected string seconds_to_iso8601 (string seconds) {
@@ -65,5 +67,7 @@
protected string uri_from_path (string path) {
return "file://%s".printf (path);
}
+
+ protected abstract void fetch_metadata () throws GLib.Error;
}
Modified: trunk/src/plugins/tracker/rygel-tracker-music-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-music-item.vala (original)
+++ trunk/src/plugins/tracker/rygel-tracker-music-item.vala Thu Dec 25 11:59:15 2008
@@ -33,9 +33,7 @@
public class Rygel.TrackerMusicItem : TrackerItem {
public TrackerMusicItem (string id,
string path,
- TrackerContainer parent) {
- base (id, path, parent);
-
+ TrackerContainer parent) throws GLib.Error {
keys = new string[] {"File:Name",
"File:Mime",
"Audio:Title",
@@ -45,10 +43,11 @@
"Audio:ReleaseDate",
"Audio:DateAdded",
"DC:Date"};
+
+ base (id, path, parent);
}
- public override void serialize (DIDLLiteWriter didl_writer)
- throws GLib.Error {
+ public override void fetch_metadata () throws GLib.Error {
string[] values = null;
/* TODO: make this async */
@@ -83,8 +82,6 @@
this.author = values[3];
this.album = values[5];
this.uri = this.uri_from_path (path);
-
- base.serialize (didl_writer);
}
}
Modified: trunk/src/plugins/tracker/rygel-tracker-video-item.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-tracker-video-item.vala (original)
+++ trunk/src/plugins/tracker/rygel-tracker-video-item.vala Thu Dec 25 11:59:15 2008
@@ -33,9 +33,7 @@
public class Rygel.TrackerVideoItem : TrackerItem {
public TrackerVideoItem (string id,
string path,
- TrackerContainer parent) {
- base (id, path, parent);
-
+ TrackerContainer parent) throws GLib.Error {
keys = new string[] {"File:Name",
"File:Mime",
"Video:Title",
@@ -43,10 +41,11 @@
"Video:Width",
"Video:Height",
"DC:Date"};
+
+ base (id, path, parent);
}
- public override void serialize (DIDLLiteWriter didl_writer)
- throws GLib.Error {
+ public override void fetch_metadata () throws GLib.Error {
string[] values = null;
/* TODO: make this async */
@@ -76,8 +75,6 @@
this.mime = values[1];
this.author = values[3];
this.uri = this.uri_from_path (path);
-
- base.serialize (didl_writer);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]