Пример #1
0
class UPnPServer:
    def __init__(self, host):
        Logr.configure(logging.DEBUG)

        self.host = host

        self.device = TmServerDevice(host)

        self.upnp = UPnP(self.device)
        self.ssdp = SSDP(self.device, [host], host)

    def run(self):
        globalLogPublisher.addObserver(analyze)

        self.upnp.listen(interface=self.host)
        self.ssdp.listen()

        self.device.setBaseUrl(self.host)

        r = CommandThread(self.device, self.upnp, self.ssdp)
        r.start()

        reactor.run()
Пример #2
0
        self.ssdp.clients.sendall_NOTIFY(None, 'ssdp:byebye', True)

        # Stop everything
        self.upnp.stop()
        self.ssdp.stop()
        reactor.stop()
        self.running = False


if __name__ == '__main__':
    Logr.configure(logging.DEBUG)

    device = MediaServerDevice()

    upnp = UPnP(device)
    ssdp = SSDP(device)

    upnp.listen()
    ssdp.listen()

    def event_test():
        #        device.contentDirectory.system_update_id = time.time()
        reactor.callLater(5, event_test)

    event_test()

    r = CommandThread(device, upnp, ssdp)
    r.start()

    reactor.run()
Пример #3
0
        # Send 'byebye' NOTIFY
        self.ssdp.clients.sendall_NOTIFY(None, 'ssdp:byebye', True)

        # Stop everything
        self.upnp.stop()
        self.ssdp.stop()
        reactor.stop()
        self.running = False

if __name__ == '__main__':
    Logr.configure(logging.DEBUG)

    device = MediaServerDevice()

    upnp = UPnP(device)
    ssdp = SSDP(device)

    upnp.listen()
    ssdp.listen()

    def event_test():
        device.contentDirectory.system_update_id = time.time()
        reactor.callLater(5, event_test)

    event_test()

    r = CommandThread(device, upnp, ssdp)
    r.start()

    reactor.run()