Browse Source

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]
replace/4e84fdb41ea781c7a8f872baa423e8b3be4045a7
John-Mark Gurney 19 years ago
parent
commit
0645e4c2ef
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      pymediaserv

+ 5
- 5
pymediaserv View File

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


Loading…
Cancel
Save