[rygel] media-export: remove unused classes



commit b990ec5b208e0ea3185b33d81012adc9014f85b3
Author: Jens Georg <mail jensge org>
Date:   Wed Jun 24 23:17:18 2009 +0200

    media-export: remove unused classes

 src/plugins/media-export/Makefile.am               |   10 +-
 .../media-export/rygel-media-export-container.vala |  165 --------------------
 ...rygel-media-export-directory-search-result.vala |  119 --------------
 .../media-export/rygel-media-export-harvester.vala |    6 +-
 .../rygel-media-export-root-container.vala         |   57 +------
 5 files changed, 16 insertions(+), 341 deletions(-)
---
diff --git a/src/plugins/media-export/Makefile.am b/src/plugins/media-export/Makefile.am
index d986c4f..8765673 100644
--- a/src/plugins/media-export/Makefile.am
+++ b/src/plugins/media-export/Makefile.am
@@ -11,10 +11,8 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
 	-I$(top_srcdir)/src/rygel -DDATA_DIR='"$(datadir)"'
 
 BUILT_SOURCES = rygel-media-export-root-container.c \
-		rygel-media-export-container.c \
-	        rygel-media-export-item.c \
+		rygel-media-export-item.c \
 		rygel-media-export-harvester.c \
-		rygel-media-export-directory-search-result.c \
 		rygel-media-export-plugin.c
 
 $(BUILT_SOURCES) : rygel-media-export.stamp
@@ -26,12 +24,8 @@ librygel_media_export_la_SOURCES = \
 	rygel-media-export-root-container.vala \
 	rygel-media-export-harvester.c \
 	rygel-media-export-harvester.vala \
-	rygel-media-export-container.c \
-	rygel-media-export-container.vala \
 	rygel-media-export-item.c \
-	rygel-media-export-item.vala \
-	rygel-media-export-directory-search-result.c \
-	rygel-media-export-directory-search-result.vala
+	rygel-media-export-item.vala
 
 rygel-media-export.stamp: $(filter %.vala,$(librygel_media_export_la_SOURCES))
 	$(VALAC) -g -C --vapidir=$(top_srcdir)/src/rygel \
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala
index 7b828e8..32d869f 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -235,7 +235,11 @@ public class Rygel.MediaExportHarvester : GLib.Object {
                                                file,
                                                tag_list);
             item.parent_ref = this.containers.peek_head ();
-            this.media_db.save_object (item);
+            try {
+                this.media_db.save_object (item);
+            } catch (Error error) {
+                // Ignore it for now
+            }
 
             this.files.pop_head ();
             if (this.files.get_length () == 0 &&
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala b/src/plugins/media-export/rygel-media-export-root-container.vala
index fdce4ff..9c167f3 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -25,7 +25,6 @@ using Gee;
  */
 public class Rygel.MediaExportRootContainer : MediaContainer {
     private MediaDB media_db;
-    private Gee.ArrayList<MediaObject> children;
     private DatabaseBackedMediaContainer root_container;
     private MetadataExtractor extractor;
     private Gee.ArrayList<MediaExportHarvester> harvester;
@@ -35,7 +34,6 @@ public class Rygel.MediaExportRootContainer : MediaContainer {
                                        Cancellable? cancellable,
                                        AsyncReadyCallback callback)
     {
-        debug ("get children called");
         this.root_container.get_children (offset,
                                           max_count,
                                           cancellable,
@@ -45,14 +43,12 @@ public class Rygel.MediaExportRootContainer : MediaContainer {
     public override Gee.List<MediaObject>? get_children_finish (
                                                     AsyncResult res)
                                                     throws GLib.Error {
-        debug ("get children_finish called");
         return this.root_container.get_children_finish (res);
     }
 
     public override void find_object (string id,
                                       Cancellable? cancellable,
                                       AsyncReadyCallback callback) {
-        debug ("find object called");
         this.root_container.find_object (id,
                                          cancellable,
                                          callback);
@@ -60,7 +56,6 @@ public class Rygel.MediaExportRootContainer : MediaContainer {
 
     public override MediaObject? find_object_finish (AsyncResult res)
                                                      throws GLib.Error {
-        debug ("find object finish called");
         return this.root_container.find_object_finish (res);
     }
 
@@ -87,8 +82,6 @@ public class Rygel.MediaExportRootContainer : MediaContainer {
         this.harvester = new Gee.ArrayList<MediaExportHarvester> ();
         ArrayList<string> uris;
 
-        this.children = new ArrayList<MediaExportContainer> ();
-
         var config = Rygel.MetaConfig.get_default ();
 
         try {
@@ -114,21 +107,17 @@ public class Rygel.MediaExportRootContainer : MediaContainer {
         }
 
         foreach (var uri in uris) {
-            var f = File.new_for_commandline_arg (uri);
-            if (f.query_exists (null)) {
+            var file = File.new_for_commandline_arg (uri);
+            if (file.query_exists (null)) {
                 var id = Checksum.compute_for_string (ChecksumType.MD5,
                                                       uri);
-                var obj = media_db.get_object (id);
-                if (obj == null) {
-                    f.query_info_async (
-                            FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE + "," +
-                            FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME + "," +
-                            FILE_ATTRIBUTE_STANDARD_TYPE + "," +
-                            FILE_ATTRIBUTE_STANDARD_NAME,
-                            FileQueryInfoFlags.NONE,
-                            Priority.DEFAULT,
-                            null,
-                            this.on_info_ready);
+                if (!this.media_db.exists (id)) {
+                    debug ("Scheduling new harvester");
+                    var harvest =
+                        new MediaExportHarvester (this.root_container, media_db,
+                                extractor);
+                    this.harvester.add (harvest);
+                    harvest.harvest (file);
                 } else {
                     this.child_count++;
                     this.updated ();
@@ -136,32 +125,4 @@ public class Rygel.MediaExportRootContainer : MediaContainer {
             }
         }
     }
-
-    private void on_info_ready (Object obj, AsyncResult res) {
-        var file = (File) obj;
-
-        try {
-            var info = file.query_info_finish (res);
-            MediaObject media_obj = null;
-
-            if (info.get_file_type () == FileType.DIRECTORY) {
-                media_obj = new MediaExportContainer (root_container, file);
-            } else {
-                media_obj = new MediaExportItem (root_container, file, info);
-            }
-
-            if (media_obj != null) {
-                debug ("Scheduling new harvester");
-                var harvest =
-                    new MediaExportHarvester (this.root_container, media_db,
-                                              extractor);
-                this.harvester.add (harvest);
-                harvest.harvest (file);
-            }
-        } catch (Error err) {
-            warning ("Failed to query information on '%s': %s\n",
-                     file.get_uri (),
-                     err.message);
-        }
-    }
 }



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