@@ -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)