[rygel] core,media-export: MediaDB name is just a name



commit 2735a39824429287dd6813cd82ef9de1d767481e
Author: Jens Georg <mail jensge org>
Date:   Sat Jun 27 00:13:29 2009 +0200

    core,media-export: MediaDB name is just a name
    
    MediaDB will decide about the file name itself, normally
    
    user_cache_dir/prgname/name.db

 .../rygel-media-export-root-container.vala         |    7 +------
 src/rygel/rygel-media-db.vala                      |    7 +++++--
 2 files changed, 6 insertions(+), 8 deletions(-)
---
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 d3d404a..51e8c5c 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -61,12 +61,7 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
      * Create a new root container.
      */
     public MediaExportRootContainer () {
-        var media_db_path = Path.build_filename (
-                                            Environment.get_user_cache_dir (),
-                                            Environment.get_prgname (),
-                                            "media-export.db");
-        debug("Using media database %s", media_db_path);
-        var db = new MediaDB(media_db_path);
+        var db = new MediaDB("media-export");
         base (db, "0", "MediaExportRoot");
 
         this.extractor = new MetadataExtractor ();
diff --git a/src/rygel/rygel-media-db.vala b/src/rygel/rygel-media-db.vala
index b154d35..6f589ba 100644
--- a/src/rygel/rygel-media-db.vala
+++ b/src/rygel/rygel-media-db.vala
@@ -124,9 +124,12 @@ public class Rygel.MediaDB : Object {
     "SELECT COUNT(upnp_id) FROM Object WHERE Object.upnp_id = ?";
 
     private void open_db (string name) {
-        var dirname = Path.get_dirname (name);
+        var dirname = Path.build_filename (Environment.get_user_cache_dir (),
+                                           Environment.get_prgname ());
         DirUtils.create_with_parents (dirname, 0750);
-        var rc = Database.open (name, out this.db);
+        var db_file = Path.build_filename (dirname, "%s.db".printf (name));
+        debug ("Using database file %s", db_file);
+        var rc = Database.open (db_file, out this.db);
         if (rc != Sqlite.OK) {
             warning ("Failed to open database: %d, %s",
                      rc,



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