예제 #1
0
        self._log("NOTIFY %s [%d]" % (url.hostname, event_key))

    def close(self):
        """Closes Event Dispacter along with its internal HTTP client."""
        self._log('CLOSE')
        self._httpclient.close()


##############################################
# MAIN
##############################################

if __name__ == '__main__':

    import Tribler.UPnP.common.taskrunner as taskrunner
    TASK_RUNNER = taskrunner.TaskRunner()

    # Parameters
    import uuid
    SID = uuid.uuid1()
    KEY = 1
    WORK_URL = "http://193.156.106.130:44444/events"
    HOME_URL = "http://192.168.1.235:44444/events"
    VARIABLES = [(u'arg1', u'data1'), (u'arg2', u'data2')]

    class MockLogger:
        """MockLogger."""
        def log(self, log_tag, msg):
            """Log to std out."""
            print log_tag, msg
예제 #2
0
    def close(self):
        """Close the UPnP server."""
        self._sm.close()
        self._ssdp_server.close()
        self._http_server.close()
        self._ed.close()


##############################################
# MAIN
##############################################

if __name__ == '__main__':

    import Tribler.UPnP.common.taskrunner as taskrunner
    TR = taskrunner.TaskRunner()

    import Tribler.UPnP.common.upnplogger as upnplogger
    LOGGER = upnplogger.get_logger()

    SERVER = UPnPServer(TR, "Product 1.0", logger=LOGGER)

    from Tribler.UPnP.services.switchpower import SwitchPower
    from Tribler.UPnP.services.urlservice import URLService
    from Tribler.UPnP.services import BookmarkService
    SERVICE_1 = SwitchPower("MySwitchPower")
    SERVICE_2 = URLService("URLService")
    SERVICE_3 = BookmarkService()
    SERVER.add_service(SERVICE_1)
    SERVER.add_service(SERVICE_2)
    SERVER.add_service(SERVICE_3)