[gnome-music/wip/mschraal/core: 7/70] coremodel: Add coregrilo
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/core: 7/70] coremodel: Add coregrilo
- Date: Tue, 18 Jun 2019 15:54:53 +0000 (UTC)
commit 5c68e1234c99802ef068aef2c1449f450fe48ade
Author: Marinus Schraal <mschraal gnome org>
Date: Wed May 8 15:59:32 2019 +0200
coremodel: Add coregrilo
gnomemusic/coregrilo.py | 35 +++++++++++++++++++++++++++++++++++
gnomemusic/coremodel.py | 3 +++
2 files changed, 38 insertions(+)
---
diff --git a/gnomemusic/coregrilo.py b/gnomemusic/coregrilo.py
new file mode 100644
index 00000000..b35939d1
--- /dev/null
+++ b/gnomemusic/coregrilo.py
@@ -0,0 +1,35 @@
+import gi
+gi.require_version('Grl', '0.3')
+from gi.repository import Grl, GObject
+
+
+class CoreGrilo(GObject.GObject):
+
+ def __repr__(self):
+ return "<CoreGrilo>"
+
+ def __init__(self):
+ super().__init__()
+
+ Grl.init(None)
+
+ self._fast_options = Grl.OperationOptions()
+ self._fast_options.set_resolution_flags(
+ Grl.ResolutionFlags.FAST_ONLY | Grl.ResolutionFlags.IDLE_RELAY)
+
+ self._full_options = Grl.OperationOptions()
+ self._full_options.set_resolution_flags(
+ Grl.ResolutionFlags.FULL | Grl.ResolutionFlags.IDLE_RELAY)
+
+ self._registry = Grl.Registry.get_default()
+ self._registry.connect('source-added', self._on_source_added)
+ self._registry.connect('source-removed', self._on_source_removed)
+
+ def _on_source_added(self, registry, source):
+ print(source.props.source_id)
+ if source.props.source_id == "grl-tracker-source":
+ self._tracker_source = source
+ print(self._tracker_source, "added")
+
+ def _on_source_removed(self, registry, source):
+ print("removed", source.props.source_id)
diff --git a/gnomemusic/coremodel.py b/gnomemusic/coremodel.py
index dc49efbc..4d6fe887 100644
--- a/gnomemusic/coremodel.py
+++ b/gnomemusic/coremodel.py
@@ -1,6 +1,7 @@
from gi.repository import GObject, Gio
from gnomemusic import log
+from gnomemusic.coregrilo import CoreGrilo
class CoreModel(GObject.GObject):
@@ -11,3 +12,5 @@ class CoreModel(GObject.GObject):
self._model = Gio.ListStore()
self._hash = {}
+
+ self._grilo = CoreGrilo()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]