|  |  | @@ -88,43 +88,7 @@ medianode.contentTypes.update( { | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | root.putChild('media', medianode) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | # Set up media files | 
		
	
		
			
			|  |  |  | def addFSPath(cds, parent, dpath): | 
		
	
		
			
			|  |  |  | dlist = os.listdir(dpath) | 
		
	
		
			
			|  |  |  | dlist.sort() | 
		
	
		
			
			|  |  |  | for i in dlist: | 
		
	
		
			
			|  |  |  | fpath = os.path.join(dpath, i) | 
		
	
		
			
			|  |  |  | try: | 
		
	
		
			
			|  |  |  | fn, ext = os.path.splitext(i) | 
		
	
		
			
			|  |  |  | ext = ext.lower() | 
		
	
		
			
			|  |  |  | if os.path.isdir(fpath): | 
		
	
		
			
			|  |  |  | folder = cds.addContainer(parent, i, klass = StorageFolder) | 
		
	
		
			
			|  |  |  | addFSPath(cds, folder, fpath) | 
		
	
		
			
			|  |  |  | if not os.path.isfile(fpath): | 
		
	
		
			
			|  |  |  | continue | 
		
	
		
			
			|  |  |  | #if ext == '.ts': | 
		
	
		
			
			|  |  |  | #	continue | 
		
	
		
			
			|  |  |  | mt = medianode.contentTypes[ext] | 
		
	
		
			
			|  |  |  | ty = mt.split('/')[0] | 
		
	
		
			
			|  |  |  | if ty == 'video': | 
		
	
		
			
			|  |  |  | klass = VideoItem | 
		
	
		
			
			|  |  |  | elif ty == 'audio': | 
		
	
		
			
			|  |  |  | klass = AudioItem | 
		
	
		
			
			|  |  |  | elif ty == 'text': | 
		
	
		
			
			|  |  |  | klass = TextItem | 
		
	
		
			
			|  |  |  | elif ty == 'image': | 
		
	
		
			
			|  |  |  | klass = ImageItem | 
		
	
		
			
			|  |  |  | else: | 
		
	
		
			
			|  |  |  | raise KeyError, 'no item for mt: %s' % mt | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | 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 | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | cds.addContainer('0', 'media', klass = FSDirectory, path = 'media', urlbase = urlbase) | 
		
	
		
			
			|  |  |  | #addFSPath(cds, '0', 'media') | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | site = server.Site(root) | 
		
	
		
			
			|  |  |  | reactor.listenTCP(listenPort, site) | 
		
	
	
		
			
				|  |  | 
 |