[gnome-music/wip/jfelder/tracker3: 13/34] trackerwrapper: Create private SPARQL connection
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/tracker3: 13/34] trackerwrapper: Create private SPARQL connection
- Date: Fri, 28 Aug 2020 14:06:30 +0000 (UTC)
commit fdba86aa640d6378d8373e9f1bdceff51c9692ea
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 | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/gnomemusic/trackerwrapper.py b/gnomemusic/trackerwrapper.py
index 135b55eb..a7bc43a3 100644
--- a/gnomemusic/trackerwrapper.py
+++ b/gnomemusic/trackerwrapper.py
@@ -23,7 +23,7 @@
from enum import IntEnum
-from gi.repository import GLib, GObject, Tracker
+from gi.repository import Gio, GLib, GObject, Tracker
from gnomemusic.musiclogger import MusicLogger
@@ -48,8 +48,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))
@@ -78,6 +81,16 @@ class TrackerWrapper(GObject.GObject):
self.notify("tracker-available")
+ def _cache_directory(self):
+ """Get directory which contains Music private data.
+
+ :returns: private store path
+ :rtype: str
+ """
+ return GLib.build_pathv(
+ GLib.DIR_SEPARATOR_S,
+ [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]