totem r6221 - in trunk: . help help/C po src/plugins/dbus-service



Author: pwithnall
Date: Wed Apr  1 18:56:17 2009
New Revision: 6221
URL: http://svn.gnome.org/viewvc/totem?rev=6221&view=rev

Log:
2009-04-01  Philip Withnall  <philip tecnocode co uk>

	* configure.in:
	* src/plugins/dbus-service/Makefile.am:
	* src/plugins/dbus-service/dbus-service.py:
	* src/plugins/dbus-service/dbus-service.totem-plugin.in: Added a
	D-Bus Service plugin by Lucky <lucky1 data gmail com>.
	(Closes: #576016)

2009-04-01  Philip Withnall  <philip tecnocode co uk>

	* C/totem.xml: Added documentation for the new D-Bus Service plugin.



Added:
   trunk/src/plugins/dbus-service/
   trunk/src/plugins/dbus-service/Makefile.am
   trunk/src/plugins/dbus-service/dbus-service.py
   trunk/src/plugins/dbus-service/dbus-service.totem-plugin.in
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/help/C/totem.xml
   trunk/help/ChangeLog
   trunk/po/ChangeLog
   trunk/po/POTFILES.in

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Wed Apr  1 18:56:17 2009
@@ -50,7 +50,7 @@
 AC_SUBST(TOTEM_VERSION_MICRO)
 
 # The full list of plugins
-allowed_plugins="thumbnail screensaver ontop galago gromit lirc media-player-keys mythtv properties sidebar-test skipto sample-python sample-vala bemused youtube publish tracker pythonconsole jamendo opensubtitles screenshot brasero-disc-recorder coherence_upnp"
+allowed_plugins="thumbnail screensaver ontop galago gromit lirc media-player-keys mythtv properties sidebar-test skipto sample-python sample-vala bemused youtube publish tracker pythonconsole jamendo opensubtitles screenshot brasero-disc-recorder coherence_upnp dbus-service"
 
 PLUGINDIR='${libdir}/totem/plugins'
 AC_SUBST(PLUGINDIR)
@@ -862,6 +862,7 @@
 src/plugins/Makefile
 src/plugins/bemused/Makefile
 src/plugins/coherence_upnp/Makefile
+src/plugins/dbus-service/Makefile
 src/plugins/screensaver/Makefile
 src/plugins/screenshot/Makefile
 src/plugins/ontop/Makefile

Modified: trunk/help/C/totem.xml
==============================================================================
--- trunk/help/C/totem.xml	(original)
+++ trunk/help/C/totem.xml	Wed Apr  1 18:56:17 2009
@@ -935,6 +935,13 @@
       <para>YouTube videos can be opened in a web browser by choosing <menuchoice><guimenuitem>Open in Web Browser</guimenuitem></menuchoice> from
         their context menu. This will open the video in its original location on the YouTube website.</para>
     </sect2>
+    <sect2 id="totem-plugins-dbus-service">
+      <title>D-Bus Service</title>
+      <para>The <guilabel>D-Bus Service</guilabel> plugin broadcasts notifications of which track is playing in <application>&app;</application>
+        on the D-Bus session bus. Applications such as <application>Gajim</application> can listen for such notifications and respond accordingly by,
+        for example, updating your instant messaging status message to display the video currently being played in
+        <application>&app;</application>.</para>
+    </sect2>
   </sect1>
 
 <!-- =========== Usage ======================================= -->

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Wed Apr  1 18:56:17 2009
@@ -44,6 +44,7 @@
 [type: gettext/ini]src/plugins/brasero-disc-recorder/brasero-disc-recorder.totem-plugin.in
 src/plugins/coherence_upnp/coherence_upnp.py
 [type: gettext/ini]src/plugins/coherence_upnp/coherence_upnp.totem-plugin.in
+[type: gettext/ini]src/plugins/dbus-service/dbus-service.totem-plugin.in
 [type: gettext/ini]src/plugins/galago/galago.totem-plugin.in
 src/plugins/galago/totem-galago.c
 [type: gettext/ini]src/plugins/gromit/gromit.totem-plugin.in

Added: trunk/src/plugins/dbus-service/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/src/plugins/dbus-service/Makefile.am	Wed Apr  1 18:56:17 2009
@@ -0,0 +1,42 @@
+plugindir = $(PLUGINDIR)/dbus
+uidir = $(plugindir)
+plugin_PYTHON = dbus-service.py
+
+plugin_in_files = dbus-service.totem-plugin.in
+
+%.totem-plugin: %.totem-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.totem-plugin.in=.totem-plugin)
+
+EXTRA_DIST = $(plugin_in_files) dbus-service.py
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA) 
+plugindir = $(PLUGINDIR)/dbus
+uidir = $(plugindir)
+plugin_PYTHON = dbus-service.py
+
+plugin_in_files = dbus-service.totem-plugin.in
+
+%.totem-plugin: %.totem-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.totem-plugin.in=.totem-plugin)
+
+EXTRA_DIST = $(plugin_in_files) dbus-service.py
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA) 
+plugindir = $(PLUGINDIR)/dbus
+uidir = $(plugindir)
+plugin_PYTHON = dbus-service.py
+
+plugin_in_files = dbus-service.totem-plugin.in
+
+%.totem-plugin: %.totem-plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
+
+plugin_DATA = $(plugin_in_files:.totem-plugin.in=.totem-plugin)
+
+EXTRA_DIST = $(plugin_in_files) dbus-service.py
+
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA) 

Added: trunk/src/plugins/dbus-service/dbus-service.py
==============================================================================
--- (empty file)
+++ trunk/src/plugins/dbus-service/dbus-service.py	Wed Apr  1 18:56:17 2009
@@ -0,0 +1,228 @@
+## Totem D-Bus plugin
+## Copyright (C) 2009 Lucky <lucky1 data gmail com>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program 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 General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor,
+## Boston, MA 02110-1301  USA.
+##
+## Sunday 13th May 2007: Bastien Nocera: Add exception clause.
+## See license_change file for details.
+
+import totem
+import gobject, gtk
+import dbus, dbus.service
+from dbus.mainloop.glib import DBusGMainLoop
+
+class dbusservice(totem.Plugin):
+	def __init__(self):
+		totem.Plugin.__init__(self)
+
+	def activate(self, totem):
+		DBusGMainLoop(set_as_default=True)
+		self.notification = Notification("/org/gnome/Totem")
+		self.title = ""
+		self.artist = ""
+		self.album = ""
+		self.duration = 0 # may be usable in future
+		totem.connect("metadata-updated", self.do_update_metadata)
+		totem.connect("notify::playing", self.do_notify)
+
+	def deactivate(self, totem):
+		self.notification.playingStopped()
+		self.notification.disconnect() # ensure we don't leak our path on the bus
+
+	def do_update_metadata(self, totem, title, artist, album, num):
+		self.title = title
+		self.artist = artist
+		self.album = album
+		if not self.title:
+			self.title = ""
+		if not self.artist:
+			self.artist = ""
+		if not self.album:
+			self.album = ""
+
+	def do_notify(self, totem, status):
+		if totem.is_playing():
+			self.notification.playingStarted(self.title, self.album, self.artist, self.duration)
+		else:
+			self.notification.playingStopped()
+
+class Notification(dbus.service.Object):
+	def __init__(self, path):
+		dbus.service.Object.__init__(self, dbus.SessionBus(), path)
+
+	def disconnect(self):
+		self.remove_from_connection(None, None)
+
+	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="sssu")
+	def playingStarted(self, title, album, artist, duration):
+		pass
+
+	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="")
+	def playingStopped(self):
+                pass
+
+## Totem D-Bus plugin
+## Copyright (C) 2009 Lucky <lucky1 data gmail com>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program 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 General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor,
+## Boston, MA 02110-1301  USA.
+##
+## Sunday 13th May 2007: Bastien Nocera: Add exception clause.
+## See license_change file for details.
+
+import totem
+import gobject, gtk
+import dbus, dbus.service
+from dbus.mainloop.glib import DBusGMainLoop
+
+class dbusservice(totem.Plugin):
+	def __init__(self):
+		totem.Plugin.__init__(self)
+
+	def activate(self, totem):
+		DBusGMainLoop(set_as_default=True)
+		self.notification = Notification("/org/gnome/Totem")
+		self.title = ""
+		self.artist = ""
+		self.album = ""
+		self.duration = 0 # may be usable in future
+		totem.connect("metadata-updated", self.do_update_metadata)
+		totem.connect("notify::playing", self.do_notify)
+
+	def deactivate(self, totem):
+		self.notification.playingStopped()
+		self.notification.disconnect() # ensure we don't leak our path on the bus
+
+	def do_update_metadata(self, totem, title, artist, album, num):
+		self.title = title
+		self.artist = artist
+		self.album = album
+		if not self.title:
+			self.title = ""
+		if not self.artist:
+			self.artist = ""
+		if not self.album:
+			self.album = ""
+
+	def do_notify(self, totem, status):
+		if totem.is_playing():
+			self.notification.playingStarted(self.title, self.album, self.artist, self.duration)
+		else:
+			self.notification.playingStopped()
+
+class Notification(dbus.service.Object):
+	def __init__(self, path):
+		dbus.service.Object.__init__(self, dbus.SessionBus(), path)
+
+	def disconnect(self):
+		self.remove_from_connection(None, None)
+
+	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="sssu")
+	def playingStarted(self, title, album, artist, duration):
+		pass
+
+	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="")
+	def playingStopped(self):
+                pass
+
+## Totem D-Bus plugin
+## Copyright (C) 2009 Lucky <lucky1 data gmail com>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program 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 General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor,
+## Boston, MA 02110-1301  USA.
+##
+## Sunday 13th May 2007: Bastien Nocera: Add exception clause.
+## See license_change file for details.
+
+import totem
+import gobject, gtk
+import dbus, dbus.service
+from dbus.mainloop.glib import DBusGMainLoop
+
+class dbusservice(totem.Plugin):
+	def __init__(self):
+		totem.Plugin.__init__(self)
+
+	def activate(self, totem):
+		DBusGMainLoop(set_as_default=True)
+		self.notification = Notification("/org/gnome/Totem")
+		self.title = ""
+		self.artist = ""
+		self.album = ""
+		self.duration = 0 # may be usable in future
+		totem.connect("metadata-updated", self.do_update_metadata)
+		totem.connect("notify::playing", self.do_notify)
+
+	def deactivate(self, totem):
+		self.notification.playingStopped()
+		self.notification.disconnect() # ensure we don't leak our path on the bus
+
+	def do_update_metadata(self, totem, title, artist, album, num):
+		self.title = title
+		self.artist = artist
+		self.album = album
+		if not self.title:
+			self.title = ""
+		if not self.artist:
+			self.artist = ""
+		if not self.album:
+			self.album = ""
+
+	def do_notify(self, totem, status):
+		if totem.is_playing():
+			self.notification.playingStarted(self.title, self.album, self.artist, self.duration)
+		else:
+			self.notification.playingStopped()
+
+class Notification(dbus.service.Object):
+	def __init__(self, path):
+		dbus.service.Object.__init__(self, dbus.SessionBus(), path)
+
+	def disconnect(self):
+		self.remove_from_connection(None, None)
+
+	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="sssu")
+	def playingStarted(self, title, album, artist, duration):
+		pass
+
+	@dbus.service.signal(dbus_interface="org.gnome.Totem", signature="")
+	def playingStopped(self):
+                pass
+

Added: trunk/src/plugins/dbus-service/dbus-service.totem-plugin.in
==============================================================================
--- (empty file)
+++ trunk/src/plugins/dbus-service/dbus-service.totem-plugin.in	Wed Apr  1 18:56:17 2009
@@ -0,0 +1,27 @@
+[Totem Plugin]
+Loader=python
+Module=dbus-service
+IAge=1
+_Name=D-Bus Service
+_Description=Plugin for sending notifications of currently-playing movies to the D-Bus subsystem.
+Authors=Lucky <lucky1 data gmail com>
+Copyright=Copyright  2009 Lucky
+Website=http://projects.gnome.org/totem/
+[Totem Plugin]
+Loader=python
+Module=dbus-service
+IAge=1
+_Name=D-Bus Service
+_Description=Plugin for sending notifications of currently-playing movies to the D-Bus subsystem.
+Authors=Lucky <lucky1 data gmail com>
+Copyright=Copyright  2009 Lucky
+Website=http://projects.gnome.org/totem/
+[Totem Plugin]
+Loader=python
+Module=dbus-service
+IAge=1
+_Name=D-Bus Service
+_Description=Plugin for sending notifications of currently-playing movies to the D-Bus subsystem.
+Authors=Lucky <lucky1 data gmail com>
+Copyright=Copyright  2009 Lucky
+Website=http://projects.gnome.org/totem/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]