~ubuntu-branches/ubuntu/intrepid/coherence/intrepid

« back to all changes in this revision

Viewing changes to coherence/upnp/services/servers/rendering_control_server.py

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Quette
  • Date: 2007-08-02 10:48:40 UTC
  • Revision ID: james.westby@ubuntu.com-20070802104840-ip4jij6unufqno1p
Tags: upstream-0.4.0
ImportĀ upstreamĀ versionĀ 0.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Licensed under the MIT license
 
2
# http://opensource.org/licenses/mit-license.php
 
3
 
 
4
# Copyright 2006, Frank Scholz <coherence@beebits.net>
 
5
 
 
6
# RenderingControl service
 
7
 
 
8
from twisted.web import resource
 
9
 
 
10
from coherence.upnp.core.soap_service import UPnPPublisher
 
11
 
 
12
from coherence.upnp.core import service
 
13
 
 
14
class RenderingControlControl(service.ServiceControl,UPnPPublisher):
 
15
 
 
16
    def __init__(self, server):
 
17
        self.service = server
 
18
        self.variables = server.get_variables()
 
19
        self.actions = server.get_actions()
 
20
 
 
21
 
 
22
class RenderingControlServer(service.ServiceServer, resource.Resource):
 
23
 
 
24
    def __init__(self, device, backend=None):
 
25
        self.device = device
 
26
        if backend == None:
 
27
            backend = self.device.backend
 
28
        resource.Resource.__init__(self)
 
29
        service.ServiceServer.__init__(self, 'RenderingControl', self.device.version, backend)
 
30
 
 
31
        self.control = RenderingControlControl(self)
 
32
        self.putChild(self.scpd_url, service.scpdXML(self, self.control))
 
33
        self.putChild(self.control_url, self.control)
 
34
        
 
35
    def listchilds(self, uri):
 
36
        cl = ''
 
37
        for c in self.children:
 
38
                cl += '<li><a href=%s/%s>%s</a></li>' % (uri,c,c)
 
39
        return cl
 
40
        
 
41
    def render(self,request):
 
42
        return '<html><p>root of the RenderingControl</p><p><ul>%s</ul></p></html>'% self.listchilds(request.uri)
 
43