Browse Source

prevent duplicate mime-types from being added...

also, don't add the video types when the file isn't a video..

[git-p4: depot-paths = "//depot/": change = 1131]
replace/b43bf02ddeddd088c0e6b94974ca1a46562eb3db
John-Mark Gurney 17 years ago
parent
commit
5ce2e92444
1 changed files with 11 additions and 7 deletions
  1. +11
    -7
      FSStorage.py

+ 11
- 7
FSStorage.py View File

@@ -13,7 +13,7 @@ import os
import sets
import stat

from DIDLLite import Container, StorageFolder, Item, VideoItem, AudioItem, TextItem, ImageItem, Resource
from DIDLLite import Container, StorageFolder, Item, VideoItem, AudioItem, TextItem, ImageItem, Resource, ResourceList
from twisted.web import resource, server, static
from twisted.python import log
from twisted.internet import abstract, interfaces, process, protocol, reactor
@@ -204,11 +204,15 @@ class FSItem(FSObject, Item):

def doUpdate(self):
#print 'FSItem doUpdate:', `self`
self.res = Resource(self.url, 'http-get:*:%s:*' % self.mimetype)
self.res.size = os.path.getsize(self.FSpath)
self.res = [ self.res ]
self.res.append(Resource(self.url + '/mpeg2', 'http-get:*:%s:*' % 'video/mpeg'))
self.res.append(Resource(self.url + '/xvid', 'http-get:*:%s:*' % 'video/x-msvideo'))
self.res = ResourceList()
r = Resource(self.url, 'http-get:*:%s:*' % self.mimetype)
r.size = os.path.getsize(self.FSpath)
self.res.append(r)
if self.mimetype.split('/', 1)[0] == 'video':
self.res.append(Resource(self.url + '/mpeg2',
'http-get:*:%s:*' % 'video/mpeg'))
self.res.append(Resource(self.url + '/xvid',
'http-get:*:%s:*' % 'video/x-msvideo'))
Item.doUpdate(self)

def ignoreFiles(path, fobj):
@@ -258,7 +262,7 @@ def dofileadd(cd, parent, path, name):
if klass is None or klass is IgnoreFile:
return

#log.msg('matched:', os.path.join(path, name), `i`, `klass`)
print 'matched:', os.path.join(path, name), `i`, `klass`
return cd.addItem(parent, klass, name, **kwargs)

class FSDirectory(FSObject, StorageFolder):


Loading…
Cancel
Save