def __init__(self, *args, **kwargs): self.mimetype = kwargs['mimetype'] del kwargs['mimetype'] ZipItem.__init__(self, *args, **kwargs) self.zi = self.zf.getinfo(self.name) kwargs['content'] = ZipResource(self.zf, self.name, self.mimetype) Item.__init__(self, *args, **kwargs) self.url = '%s/%s' % (self.cd.urlbase, self.id) self.res = Resource(self.url, 'http-get:*:%s:*' % self.mimetype) self.res.size = self.zi.file_size
def __init__(self, *args, **kwargs): FSObject.__init__(self, kwargs['path']) del kwargs['path'] mimetype = kwargs['mimetype'] del kwargs['mimetype'] kwargs['content'] = DynamicTrans(self.FSpath, static.File(self.FSpath, mimetype)) Item.__init__(self, *args, **kwargs) self.url = '%s/%s' % (self.cd.urlbase, self.id) self.mimetype = mimetype self.checkUpdate()
def doUpdate(self): #print 'FSItem doUpdate:', `self` 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)