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