[gnome-music/wip/merge: 318/343] Create new file mpris.py
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/merge: 318/343] Create new file mpris.py
- Date: Thu, 25 Jul 2013 11:39:21 +0000 (UTC)
commit 89f70e9bfe77e2ae9734a1d5d3b690d1cb7862b5
Author: Arnel A. Borja <arnelborja src gnome org>
Date: Sun Jul 21 22:42:41 2013 +0800
Create new file mpris.py
The file will contain the service for all interfaces of MPRIS implemented
by gnome-music.
gnomemusic/Makefile.am | 1 +
gnomemusic/mpris.py | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/gnomemusic/Makefile.am b/gnomemusic/Makefile.am
index cedab49..f5e7062 100644
--- a/gnomemusic/Makefile.am
+++ b/gnomemusic/Makefile.am
@@ -5,6 +5,7 @@ app_PYTHON = \
application.py \
__init__.py \
player.py \
+ mpris.py \
toolbar.py \
view.py \
grilo.py \
diff --git a/gnomemusic/mpris.py b/gnomemusic/mpris.py
new file mode 100644
index 0000000..4fdf9da
--- /dev/null
+++ b/gnomemusic/mpris.py
@@ -0,0 +1,35 @@
+import dbus
+import dbus.service
+from dbus.mainloop.glib import DBusGMainLoop
+
+
+class MediaPlayer2Service(dbus.service.Object):
+ def __init__(self, app):
+ DBusGMainLoop(set_as_default=True)
+ name = dbus.service.BusName('org.mpris.MediaPlayer2.GnomeMusic', dbus.SessionBus())
+ dbus.service.Object.__init__(self, name, '/org/mpris/MediaPlayer2')
+ self.app = app
+
+ @dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
+ in_signature='ss', out_signature='v')
+ def Get(self, interface_name, property_name):
+ return self.GetAll(interface_name)[property_name]
+
+ @dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
+ in_signature='s', out_signature='a{sv}')
+ def GetAll(self, interface_name):
+ raise dbus.exceptions.DBusException(
+ 'org.mpris.MediaPlayer2.GnomeMusic',
+ 'This object does not implement the %s interface'
+ % interface_name)
+
+ @dbus.service.method(dbus_interface=dbus.PROPERTIES_IFACE,
+ in_signature='ssv')
+ def Set(self, interface_name, property_name, new_value):
+ pass
+
+ @dbus.service.signal(dbus_interface=dbus.PROPERTIES_IFACE,
+ signature='sa{sv}as')
+ def PropertiesChanged(self, interface_name, changed_properties,
+ invalidated_properties):
+ pass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]