diff vixm/player.py @ 43:d3ac3a46a294 pure

Abuse the Rhythmbox dbus messages to announce what is being played
author Josef "Jeff" Sipek <jeffpc@josefsipek.net>
date Mon, 06 Nov 2006 04:50:55 -0500
parents bc6db55448e1
children c46d3f8833f9
line wrap: on
line diff
--- a/vixm/player.py	Sun Nov 05 19:25:30 2006 -0500
+++ b/vixm/player.py	Mon Nov 06 04:50:55 2006 -0500
@@ -3,7 +3,7 @@
 
 import mad, ao
 
-import playlist, stats
+import playlist, stats, rb_dbus
 
 class playerThread(Thread):
 	def __init__(self):
@@ -20,6 +20,9 @@
 
 		self.stats    = stats.statsengine("stats")
 
+		self.rb       = rb_dbus.RhythmboxDbusThread(self)
+		self.rb.start()
+
 	def play_next(self, lists):
 		try:
 			# pop song off the PRIO queue
@@ -43,9 +46,16 @@
 
 	def run(self):
 		while not self.shutdown:
-			if self.current and self.playing:
+			c = self.current
+
+			if c and self.playing:
+				# notify everyone
+
+				self.rb.notify("file://" + c["file"], \
+						c["title"], c["artist"])
+
 				# play the file
-				mf = mad.MadFile(self.current["file"])
+				mf = mad.MadFile(c["file"])
 		
 				while True:
 					buf = mf.read(self.blksize)