Browse Source

properly handle subdirs now...

add support for images...

lowercase the extension...

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

+ 5
- 2
pymediaserv View File

@@ -5,7 +5,7 @@
# Copyright 2005, Tim Potter <tpot@samba.org>
# Copyright 2006 John-Mark Gurney <gurney_j@resnet.uroegon.edu>

from DIDLLite import TextItem, AudioItem, VideoItem, Resource, StorageFolder
from DIDLLite import TextItem, AudioItem, VideoItem, ImageItem, Resource, StorageFolder
import os
import os.path
import random
@@ -93,6 +93,7 @@ def addFSPath(parent, title, dpath):
fpath = os.path.join(dpath, i)
try:
fn, ext = os.path.splitext(i)
ext = ext.lower()
if os.path.isdir(fpath):
addFSPath(folder, fn, fpath)
if not os.path.isfile(fpath):
@@ -107,11 +108,13 @@ def addFSPath(parent, title, dpath):
klass = AudioItem
elif ty == 'text':
klass = TextItem
elif ty == 'image':
klass = ImageItem
else:
raise KeyError, 'no item for mt: %s' % mt

item = cds.addItem(folder, klass, fn)
cds[item].res = Resource('%smedia/%s' % (urlbase, i), 'http-get:*:%s:*' % mt)
cds[item].res = Resource('%s%s' % (urlbase, fpath), 'http-get:*:%s:*' % mt)
cds[item].res.size = os.path.getsize(fpath)
except KeyError:
pass


Loading…
Cancel
Save