Browse Source

go to tabs..

[git-p4: depot-paths = "//depot/": change = 761]
replace/4e84fdb41ea781c7a8f872baa423e8b3be4045a7
John-Mark Gurney 19 years ago
parent
commit
d9d2d8b879
1 changed files with 21 additions and 21 deletions
  1. +21
    -21
      pymediaserv

+ 21
- 21
pymediaserv View File

@@ -50,18 +50,18 @@ from ContentDirectory import ContentDirectoryServer
from ConnectionManager import ConnectionManagerServer

class WebServer(resource.Resource):
def __init__(self):
resource.Resource.__init__(self)
def __init__(self):
resource.Resource.__init__(self)

class RootDevice(static.Data):
def __init__(self):
r = {
'hostname': socket.gethostname(),
'uuid': uuid,
'urlbase': urlbase,
}
d = file('root-device.xml').read() % r
static.Data.__init__(self, d, 'text/xml')
def __init__(self):
r = {
'hostname': socket.gethostname(),
'uuid': uuid,
'urlbase': urlbase,
}
d = file('root-device.xml').read() % r
static.Data.__init__(self, d, 'text/xml')

root = WebServer()
cds = ContentDirectoryServer('My Media Server')
@@ -122,7 +122,7 @@ def addFSPath(cds, parent, dpath):
cds[item].res = Resource('%s%s' % (urlbase, fpath), 'http-get:*:%s:*' % mt)
cds[item].res.size = os.path.getsize(fpath)
except KeyError:
pass
pass

addFSPath(cds, '0', 'media')

@@ -131,24 +131,24 @@ reactor.listenTCP(listenPort, site)

# we need to do this after the children are there, since we send notifies
s.register('%s::upnp:rootdevice' % uuid,
'upnp:rootdevice',
urlbase + 'root-device.xml')
'upnp:rootdevice',
urlbase + 'root-device.xml')

s.register(uuid,
uuid,
urlbase + 'root-device.xml')
uuid,
urlbase + 'root-device.xml')

s.register('%s::urn:schemas-upnp-org:device:MediaServer:1' % uuid,
'urn:schemas-upnp-org:device:MediaServer:1',
urlbase + 'root-device.xml')
'urn:schemas-upnp-org:device:MediaServer:1',
urlbase + 'root-device.xml')

s.register('%s::urn:schemas-upnp-org:service:ConnectionManager:1' % uuid,
'urn:schemas-upnp-org:device:ConnectionManager:1',
urlbase + 'root-device.xml')
'urn:schemas-upnp-org:device:ConnectionManager:1',
urlbase + 'root-device.xml')

s.register('%s::urn:schemas-upnp-org:service:ContentDirectory:1' % uuid,
'urn:schemas-upnp-org:device:ContentDirectory:1',
urlbase + 'root-device.xml')
'urn:schemas-upnp-org:device:ContentDirectory:1',
urlbase + 'root-device.xml')

# Main loop



Loading…
Cancel
Save