From 0645e4c2ef204865d8f186babe7ae3bad5214359 Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Mon, 20 Feb 2006 09:40:59 -0800 Subject: [PATCH] use full filename for folder's title... change how addFSPath works and instead of creating the container to put it all in, we put it in the container specified, and create sub-containers before recursing.. [git-p4: depot-paths = "//depot/": change = 747] --- pymediaserv | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pymediaserv b/pymediaserv index dfd269d..2f91b87 100755 --- a/pymediaserv +++ b/pymediaserv @@ -88,8 +88,7 @@ medianode.contentTypes.update( { root.putChild('media', medianode) # Set up media files -def addFSPath(parent, title, dpath): - folder = cds.addContainer(parent, title, klass = StorageFolder) +def addFSPath(parent, dpath): dlist = os.listdir(dpath) dlist.sort() for i in dlist: @@ -98,7 +97,8 @@ def addFSPath(parent, title, dpath): fn, ext = os.path.splitext(i) ext = ext.lower() if os.path.isdir(fpath): - addFSPath(folder, fn, fpath) + folder = cds.addContainer(parent, i, klass = StorageFolder) + addFSPath(folder, fpath) if not os.path.isfile(fpath): continue #if ext == '.ts': @@ -116,13 +116,13 @@ def addFSPath(parent, title, dpath): else: raise KeyError, 'no item for mt: %s' % mt - item = cds.addItem(folder, klass, i) + item = cds.addItem(parent, klass, i) cds[item].res = Resource('%s%s' % (urlbase, fpath), 'http-get:*:%s:*' % mt) cds[item].res.size = os.path.getsize(fpath) except KeyError: pass -addFSPath('0', 'All Media', 'media') +addFSPath('0', 'media') site = server.Site(root) reactor.listenTCP(listenPort, site)