rendered paste bodyIndex: upnp_coherence/__init__.py
===================================================================
--- upnp_coherence/__init__.py (revision 5480)
+++ upnp_coherence/__init__.py (working copy)
@@ -1,6 +1,8 @@
import rhythmdb, rb
import gobject, gtk
import louie
+# For the icon
+import os.path, urllib, gnomevfs, gtk.gdk
class CoherencePlugin(rb.Plugin):
@@ -32,10 +34,30 @@
'Coherence.UPnP.ControlPoint.MediaServer.removed',
louie.Any)
+ # Set up our icon
+ face_path = os.path.join(os.path.expanduser('~'), ".face")
+ if os.path.exists(face_path):
+ url = urllib.pathname2url(face_path)
+
+ if url:
+ mimetype = gnomevfs.get_mime_type(url)
+ pixbuf = gtk.gdk.pixbuf_new_from_file(url)
+ width = pixbuf.get_width()
+ height = pixbuf.get_height()
+ channels = pixbuf.get_has_alpha()
+ depth = pixbuf.get_bits_per_sample() * channels
+ icon = {
+ 'url':url,
+ 'mimetype': mimetype,
+ 'width':width,
+ 'height':height,
+ 'depth':channels
+ }
+
# create our own media server
from coherence.upnp.devices.media_server import MediaServer
from MediaStore import MediaStore
- server = MediaServer(self.coherence, MediaStore, no_thread_needed=True, db=self.shell.props.db, plugin=self)
+ server = MediaServer(self.coherence, MediaStore, no_thread_needed=True, db=self.shell.props.db, plugin=self, icon=icon)
def deactivate(self, shell):
print "coherence UPnP plugin deactivated"