A Python UPnP Media Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
725 B

  1. #!/usr/bin/env python
  2. from twisted.internet import reactor
  3. __all__ = [ 'appendnamespace', 'insertnamespace', ]
  4. appendnamespace = lambda k, v: []
  5. insertnamespace = lambda k, v: None
  6. def doDebugging(opt):
  7. if not opt:
  8. return
  9. from twisted.manhole import telnet
  10. class Debug(telnet.Shell):
  11. def welcomeMessage(self):
  12. data = [ '', 'PyMedS Debugging Console', '', '' ]
  13. return '\r\n'.join(data)
  14. sf = telnet.ShellFactory()
  15. sf.protocol = Debug
  16. reactor.listenTCP(56283, sf)
  17. global insertnamespace, appendnamespace
  18. def insertnamespace(k, v):
  19. assert isinstance(k, basestring)
  20. sf.namespace[k] = v
  21. def appendnamespace(k, v):
  22. try:
  23. sf.namespace[k].append(v)
  24. except KeyError:
  25. sf.namespace[k] = [ v ]