Source code for coherence.upnp.services.servers.scheduled_recording_server

# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php

# Copyright 2009, Frank Scholz <coherence@beebits.net>

# ScheduledRecording service

from twisted.web import resource

from coherence.upnp.core import service
from coherence.upnp.core.soap_service import UPnPPublisher
from coherence.upnp.core.utils import to_string


[docs]class ScheduledRecordingControl(service.ServiceControl, UPnPPublisher): def __init__(self, server): service.ServiceControl.__init__(self) UPnPPublisher.__init__(self) self.service = server self.variables = server.get_variables() self.actions = server.get_actions()
[docs]class ScheduledRecordingServer(service.ServiceServer, resource.Resource): implementation = 'optional' def __init__(self, device, backend=None): self.device = device if backend is None: backend = self.device.backend resource.Resource.__init__(self) self.version = 1 service.ServiceServer.__init__( self, 'ScheduledRecording', self.version, backend) self.control = ScheduledRecordingControl(self) self.putChild(self.scpd_url, service.scpdXML(self, self.control)) self.putChild(self.control_url, self.control)
[docs] def listchilds(self, uri): uri = to_string(uri) cl = '' for c in self.children: c = to_string(c) cl += '<li><a href=%s/%s>%s</a></li>' % (uri, c, c) return cl
[docs] def render(self, request): html = """\ <html> <head> <title>Cohen3 (ScheduledRecordingServer)</title> <link rel="stylesheet" type="text/css" href="/styles/main.css" /> </head> <h5> <img class="logo-icon" src="/server-images/coherence-icon.svg"> </img>Root of the ScheduledRecording</h5> <div class="list"><ul>%s</ul></div> </html>""" % self.listchilds(request.uri) return html.encode('ascii')