Browse Source

make the uuid: part of the generateuuid function, and make the

uuid variable include it also...  fix xml to be same...

support randomly assigning the port of the web server... this
makes more sense than always using 8080..

[git-p4: depot-paths = "//depot/": change = 723]
replace/5b80aeb26dc425aaddcd5182126c969e5cc04cbb
John-Mark Gurney 19 years ago
parent
commit
76b405174c
2 changed files with 7 additions and 7 deletions
  1. +4
    -4
      pymediaserv
  2. +3
    -3
      root-device.xml

+ 4
- 4
pymediaserv View File

@@ -14,8 +14,8 @@ from twisted.internet import reactor

def generateuuid():
if False:
return 'asdflkjewoifjslkdfj'
return ''.join(map(lambda x: random.choice(string.letters), xrange(20)))
return 'uuid:asdflkjewoifjslkdfj'
return ''.join([ 'uuid:'] + map(lambda x: random.choice(string.letters), xrange(20)))

listenAddr = sys.argv[1]
if len(sys.argv) > 2:
@@ -23,7 +23,7 @@ if len(sys.argv) > 2:
if listenPort < 1024 or listenPort > 65535:
raise ValueError, 'port out of range'
else:
listenPort = 8080
listenPort = random.randint(10000, 65000)

log.startLogging(sys.stdout)

@@ -37,7 +37,7 @@ port = reactor.listenMulticast(SSDP_PORT, s)
port.joinGroup(SSDP_ADDR)
port.setLoopbackMode(0) # don't get our own sends

uuid = 'uuid:' + generateuuid()
uuid = generateuuid()
urlbase = 'http://%s:%d/' % (listenAddr, listenPort)

# Create SOAP server


+ 3
- 3
root-device.xml View File

@@ -15,19 +15,19 @@
<modelNumber>1</modelNumber>
<modelURL>about:blank</modelURL>
<serialNumber>0</serialNumber>
<UDN>uuid:%(uuid)s</UDN>
<UDN>%(uuid)s</UDN>
<UPC/>
<serviceList>
<service>
<serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
<serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
<serviceId>urn:upnp-org:serviceId:urn:schemas-upnp-org:service:ConnectionManager</serviceId>
<SCPDURL>ConnectionManager/scpd.xml</SCPDURL>
<controlURL>ConnectionManager/control</controlURL>
<eventSubURL>ConnectionManager/event</eventSubURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:ContentDirectory:1</serviceType>
<serviceId>urn:upnp-org:serviceId:ContenDirectory</serviceId>
<serviceId>urn:upnp-org:serviceId:urn:schemas-upnp-org:service:ContenDirectory</serviceId>
<SCPDURL>ContentDirectory/scpd.xml</SCPDURL>
<controlURL>ContentDirectory/control</controlURL>
<eventSubURL>ContentDirectory/event</eventSubURL>


Loading…
Cancel
Save