Exemplo n.º 1
0
 def datagram_received(self, datagram, address):
     if get_setting_as_bool('debug-ssdp'):
         logger.debug('Datagram received. Address:{}; Content:{}'.format(
             address, datagram))
     if "urn:dial-multiscreen-org:service:dial:1" in datagram and "M-SEARCH" in datagram:
         if get_setting_as_bool('debug-ssdp'):
             logger.debug("Answering datagram")
         data = build_template(self.header).render(
             ip=self.get_remote_ip(address), uuid=Kodicast.uuid)
         self.reply(data, address)
Exemplo n.º 2
0
def service_desc():
    ''' route for DIAL service discovery '''
    response.set_header('Access-Control-Allow-Method',
                        'GET, POST, DELETE, OPTIONS')
    response.set_header('Access-Control-Expose-Headers', 'Location')
    response.set_header('Application-URL',
                        'http://{}/apps'.format(request.get_header('host')))
    response.set_header('Content-Type', 'application/xml')
    return build_template(__device__).render(
        friendlyName=Kodicast.friendlyName,
        uuid=Kodicast.uuid,
        path="http://%s" % request.get_header('host'))