~ubuntu-branches/ubuntu/maverick/coherence/maverick

« back to all changes in this revision

Viewing changes to misc/Rhythmbox-Plugin/upnp_coherence/__init__.py

  • Committer: Bazaar Package Importer
  • Author(s): Charlie Smotherman
  • Date: 2010-01-02 10:57:15 UTC
  • mfrom: (1.1.7 upstream) (3.2.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100102105715-sghzl2nw4lr5b1ob
Tags: 0.6.6.2-1
*  New  upstream release, summary of changes:
    - adding all necessary files to MANIFEST.in, to compensate for the
      gone 'auto-include-all-files-under-version-control' setuptools
      feature.
    - rearranging genre and genres attribute in DIDLLite - thx Caleb  
    - fix face_path typo, fixes #275.   

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
 
10
10
import rhythmdb, rb
11
 
import gobject, gtk
 
11
import gobject
 
12
gobject.threads_init()
12
13
 
13
14
import gconf
14
15
 
17
18
from coherence import log
18
19
 
19
20
# for the icon
20
 
import os.path, urllib, gnomevfs, gtk.gdk
 
21
import os.path, urllib, gio, gtk.gdk
21
22
 
22
23
# the gconf configuration
23
24
gconf_keys = {
63
64
            gtk2reactor.install()
64
65
        except AssertionError, e:
65
66
            # sometimes it's already installed
66
 
            print e
 
67
            self.warning("gtk2reactor already installed %r" % e)
67
68
 
68
69
        self.coherence = self.get_coherence()
69
70
        if self.coherence is None:
70
 
            print "Coherence is not installed or too old, aborting"
 
71
            self.warning("Coherence is not installed or too old, aborting")
71
72
            return
72
73
 
73
 
        print "coherence UPnP plugin activated"
 
74
        self.warning("Coherence UPnP plugin activated")
 
75
 
74
76
        self.shell = shell
75
77
        self.sources = {}
76
78
 
78
80
        the_icon = None
79
81
        face_path = os.path.join(os.path.expanduser('~'), ".face")
80
82
        if os.path.exists(face_path):
81
 
            url = "file://" + urllib.pathname2url(face_path)
82
 
            mimetype = gnomevfs.get_mime_type(url)
 
83
            file = gio.File(file=face_path);
 
84
            url = file.get_uri();
 
85
            info = file.query_info("standard::fast-content-type");
 
86
            mimetype = info.get_attribute_as_string("standard::fast-content-type");
83
87
            pixbuf = gtk.gdk.pixbuf_new_from_file(face_path)
84
88
            width = "%s" % pixbuf.get_width()
85
89
            height = "%s" % pixbuf.get_height()
165
169
                    'Coherence.UPnP.ControlPoint.MediaServer.removed',
166
170
                    louie.Any)
167
171
 
168
 
 
169
172
    def deactivate(self, shell):
170
173
        self.info("Coherence UPnP plugin deactivated")
171
174
        if self.coherence is None: