summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2014-03-24 17:49:19 +0200
committerJens Georg <mail@jensge.org>2015-04-19 15:24:08 +0200
commitb8436db29c49af255d4755fc406cf60ea4f4884c (patch)
tree27adece1c395c33e56bf4d7d928e621282ee9433
parent10b51a88bbd6394c779fe9bd4ebd3e18192a1219 (diff)
downloadrygel-b8436db29c49af255d4755fc406cf60ea4f4884c.tar.gz
lms: get db path over dbus from LMS
-rw-r--r--src/plugins/lms/Makefile.am3
-rw-r--r--src/plugins/lms/rygel-lms-dbus-interfaces.vala28
-rw-r--r--src/plugins/lms/rygel-lms-root-container.vala14
3 files changed, 40 insertions, 5 deletions
diff --git a/src/plugins/lms/Makefile.am b/src/plugins/lms/Makefile.am
index 1e777dd5..f96a2ab4 100644
--- a/src/plugins/lms/Makefile.am
+++ b/src/plugins/lms/Makefile.am
@@ -22,7 +22,8 @@ librygel_lms_la_SOURCES = \
rygel-lms-image-year.vala \
rygel-lms-sql-function.vala \
rygel-lms-sql-operator.vala \
- rygel-lms-collate.c
+ rygel-lms-collate.c \
+ rygel-lms-dbus-interfaces.vala
librygel_lms_la_VALAFLAGS = \
--enable-experimental \
diff --git a/src/plugins/lms/rygel-lms-dbus-interfaces.vala b/src/plugins/lms/rygel-lms-dbus-interfaces.vala
new file mode 100644
index 00000000..6c14f5b2
--- /dev/null
+++ b/src/plugins/lms/rygel-lms-dbus-interfaces.vala
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2014 Intel Corporation.
+ *
+ * Author: Alexander Kanavin <alex.kanavin@gmail.com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+[DBus (name = "org.lightmediascanner.Scanner1")]
+interface Rygel.LMS.DBus : Object {
+ public abstract string data_base_path { owned get; }
+
+ //TODO: add all the other API items which are currently unused
+} \ No newline at end of file
diff --git a/src/plugins/lms/rygel-lms-root-container.vala b/src/plugins/lms/rygel-lms-root-container.vala
index d7307be8..a7a7f982 100644
--- a/src/plugins/lms/rygel-lms-root-container.vala
+++ b/src/plugins/lms/rygel-lms-root-container.vala
@@ -38,11 +38,17 @@ public class Rygel.LMS.RootContainer : Rygel.SimpleContainer {
base.root(title);
- string db_path;
+ string db_path = null;
try {
- db_path = config.get_string ("LightMediaScanner", "db-path");
- debug ("Using sqlite database location '%s'", db_path);
- } catch (GLib.Error error) {
+ LMS.DBus lms_proxy = Bus.get_proxy_sync (BusType.SESSION,
+ "org.lightmediascanner",
+ "/org/lightmediascanner/Scanner1");
+ db_path = lms_proxy.data_base_path;
+ debug ("Got db path %s from LMS over dbus", db_path);
+ } catch (Error e) {
+ warning("Using dbus to get db location failed: %s", e.message);
+ }
+ if (db_path == null) {
db_path = Environment.get_user_config_dir() +
"/lightmediascannerd/db.sqlite3";
debug ("Using default sqlite database location %s", db_path);