~ubuntu-branches/ubuntu/saucy/coherence/saucy

« back to all changes in this revision

Viewing changes to coherence/upnp/devices/media_renderer.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:
15
15
 
16
16
from coherence.extern.et import ET, indent
17
17
 
 
18
from coherence.upnp.core.utils import StaticFile
 
19
 
18
20
from coherence.upnp.services.servers.connection_manager_server import ConnectionManagerServer
19
21
from coherence.upnp.services.servers.rendering_control_server import RenderingControlServer
20
22
from coherence.upnp.services.servers.av_transport_server import AVTransportServer
32
34
    device_type = 'MediaRenderer'
33
35
 
34
36
    def fire(self,backend,**kwargs):
 
37
 
35
38
        if kwargs.get('no_thread_needed',False) == False:
36
39
            """ this could take some time, put it in a  thread to be sure it doesn't block
37
40
                as we can't tell for sure that every backend is implemented properly """
121
124
        for icon in self.icons:
122
125
            if icon.has_key('url'):
123
126
                if icon['url'].startswith('file://'):
124
 
                    self.web_resource.putChild(os.path.basename(icon['url']),
125
 
                                               static.File(icon['url'][7:]))
 
127
                    if os.path.exists(icon['url'][7:]):
 
128
                        self.web_resource.putChild(os.path.basename(icon['url']),
 
129
                                                   StaticFile(icon['url'][7:],defaultType=icon['mimetype']))
 
130
                elif icon['url'] == '.face':
 
131
                    face_path = os.path.abspath(os.path.join(os.path.expanduser('~'), ".face"))
 
132
                    if os.path.exists(face_path):
 
133
                        self.web_resource.putChild('face-icon.png',StaticFile(face_path,defaultType=icon['mimetype']))
 
134
                else:
 
135
                    from pkg_resources import resource_filename
 
136
                    icon_path = os.path.abspath(resource_filename(__name__, os.path.join('..','..','..','misc','device-icons',icon['url'])))
 
137
                    if os.path.exists(icon_path):
 
138
                        self.web_resource.putChild(icon['url'],StaticFile(icon_path,defaultType=icon['mimetype']))
 
139
 
126
140
 
127
141
        self.register()
128
142
        self.warning("%s %s (%s) activated with %s" % (self.backend.name, self.device_type, self.backend, str(self.uuid)[5:]))