[gnome-music/wip/carlosg/tracker3: 1/17] trackerwrapper: Create private SPARQL connection
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/carlosg/tracker3: 1/17] trackerwrapper: Create private SPARQL connection
- Date: Sun, 14 Jun 2020 17:51:05 +0000 (UTC)
commit 64d82ddda8802a4facbbc86ed62235f9206d049a
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun May 31 17:40:53 2020 +0200
trackerwrapper: Create private SPARQL connection
GNOME Music wants to store its own data for some things, have
it create a private store at ~/.cache/gnome-music/db/
gnomemusic/trackerwrapper.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/trackerwrapper.py b/gnomemusic/trackerwrapper.py
index 56d27a2f..15fd49f3 100644
--- a/gnomemusic/trackerwrapper.py
+++ b/gnomemusic/trackerwrapper.py
@@ -21,9 +21,11 @@
# code, but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version.
+import os
+
from enum import Enum, IntEnum
-from gi.repository import GLib, GObject, Tracker
+from gi.repository import Gio, GLib, GObject, Tracker
from gnomemusic.musiclogger import MusicLogger
@@ -63,8 +65,11 @@ class TrackerWrapper(GObject.GObject):
self._tracker_available = TrackerState.UNAVAILABLE
try:
- self._tracker = Tracker.SparqlConnection.bus_new(
- "org.freedesktop.Tracker3.Miner.Files", None, None)
+ self._tracker = Tracker.SparqlConnection.new(
+ Tracker.SparqlConnectionFlags.NONE,
+ Gio.File.new_for_path(self.cache_directory()),
+ Tracker.sparql_get_ontology_nepomuk(),
+ None)
except GLib.Error as error:
self._log.warning(
"Error: {}, {}".format(error.domain, error.message))
@@ -93,6 +98,9 @@ class TrackerWrapper(GObject.GObject):
self.notify("tracker-available")
+ def cache_directory(self):
+ return os.path.join(GLib.get_user_cache_dir(), 'gnome-music', 'db')
+
@GObject.Property(type=object, flags=GObject.ParamFlags.READABLE)
def tracker(self):
return self._tracker
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]