def doUpdate(self): # open the DVD as necessary. self.dvd = DVD(self.FSpath) doupdate = False origchildren, toindex = gennameindexes('Title', self.dvd) children = sets.Set(origchildren) for i in self.pathObjmap.keys(): if i not in children: doupdate = True # delete self.cd.delItem(self.pathObjmap[i]) del self.pathObjmap[i] for i in origchildren: if i in self.pathObjmap: continue # new object self.pathObjmap[i] = self.cd.addItem(self.id, DVDTitle, i, dvdtitle = self.dvd[toindex[i]], dvddisc = self) doupdate = True if doupdate: StorageFolder.doUpdate(self)
def doUpdate(self): f = mpegts.TSPStream(_LimitedFile(self.FSpath, size= 2*1024*1024)) self.tvct = mpegts.GetTVCT(f) doupdate = False origchildren, toindex = _gennameindexes(self.tvct['channels']) #log.msg('MultiMPEGTS doUpdate: tvct: %s' % self.tvct) children = sets.Set(origchildren) for i in self.pathObjmap.keys(): if i not in children: doupdate = True # delete self.cd.delItem(self.pathObjmap[i]) del self.pathObjmap[i] for i in origchildren: if i in self.pathObjmap: continue # new object if toindex[i]['prog_num'] == 0: log.msg('bogus:', toindex[i]) continue #log.msg('real tvct:', toindex[i], toindex.keys(), # self.tvct) self.pathObjmap[i] = self.cd.addItem(self.id, MPEGTS, i, path = self.FSpath, tvct = toindex[i]) doupdate = True if doupdate: StorageFolder.doUpdate(self)
def __init__(self, *args, **kwargs): path = kwargs['path'] del kwargs['path'] StorageFolder.__init__(self, *args, **kwargs) FSObject.__init__(self, path) # mapping from path to objectID self.pathObjmap = {}
def __init__(self, *args, **kwargs): '''If a zip argument is passed it, use that as the zip archive.''' path = kwargs['path'] del kwargs['path'] StorageFolder.__init__(self, *args, **kwargs) FSObject.__init__(self, path) # mapping from path to objectID self.pathObjmap = {}
def __init__(self, *args, **kwargs): self.hier = kwargs['hier'] self.sep = kwargs['sep'] del kwargs['hier'], kwargs['sep'] ZipItem.__init__(self, *args, **kwargs) del kwargs['zf'], kwargs['zo'], kwargs['name'] StorageFolder.__init__(self, *args, **kwargs) # mapping from path to objectID self.pathObjmap = {}
def __init__(self, *args, **kwargs): self.dvdtitle = kwargs['dvdtitle'] self.dvddisc = kwargs['dvddisc'] del kwargs['dvdtitle'], kwargs['dvddisc'] audio = self.dvdtitle.selectaudio(default_audio_lang) kwargs['content'] = IterGenResource(lambda dt = self.dvdtitle, p = audio.pos: audiofilter(itertools.chain(*dt), 0x80 + p)) StorageFolder.__init__(self, *args, **kwargs) self.url = '%s/%s' % (self.cd.urlbase, self.id) self.res = Resource(self.url, 'http-get:*:video/mpeg:*') # mapping from path to objectID self.pathObjmap = {}
def doUpdate(self): # open the zipfile as necessary. self.zip = genZipFile(self.FSpath) nl = self.zip.namelist() cnt = 0 cursep = None for i in self.seps: newsum = sum([ j.count(i) for j in nl ]) if newsum > cnt: cursep = i cnt = newsum self.sep = cursep hier = buildNameHier(nl, self.zip.infolist(), cursep) doupdate = False children = sets.Set(hier.keys()) for i in self.pathObjmap.keys(): if i not in children: doupdate = True # delete self.cd.delItem(self.pathObjmap[i]) del self.pathObjmap[i] for i in children: if i in self.pathObjmap: continue # new object if isinstance(hier[i], dict): # must be a dir self.pathObjmap[i] = self.cd.addItem(self.id, ZipChildDir, i, zf=self.zip, zo=self, name=i, hier=hier[i], sep=cursep) else: klass, mt = FileDIDL.buildClassMT(ZipFile, i) if klass is None: continue self.pathObjmap[i] = self.cd.addItem(self.id, klass, i, zf = self.zip, zo = self, name = i, mimetype = mt) doupdate = True # sort our children self.sort(lambda x, y: cmp(x.title, y.title)) if doupdate: StorageFolder.doUpdate(self)
def doUpdate(self): doupdate = False origchildren, toindex = gennameindexes('Chapter', self.dvdtitle) children = sets.Set(origchildren) for i in self.pathObjmap.keys(): if i not in children: doupdate = True # delete self.cd.delItem(self.pathObjmap[i]) del self.pathObjmap[i] for i in origchildren: if i in self.pathObjmap: continue # new object self.pathObjmap[i] = self.cd.addItem(self.id, DVDChapter, i, dvdtitle = self.dvdtitle, chapter = self.dvdtitle[toindex[i]]) doupdate = True if doupdate: StorageFolder.doUpdate(self)
def doUpdate(self): doupdate = False children = sets.Set(self.hier.keys()) for i in self.pathObjmap.keys(): if i not in children: # delete doupdate = True self.cd.delItem(self.pathObjmap[i]) del self.pathObjmap[i] cursep = self.sep for i in children: if i in self.pathObjmap: continue # new object pathname = cursep.join((self.name, i)) if isinstance(self.hier[i], dict): # must be a dir self.pathObjmap[i] = self.cd.addItem(self.id, ZipChildDir, i, zf=self.zf, zo=self, name=pathname, hier=self.hier[i], sep=cursep) else: klass, mt = FileDIDL.buildClassMT(ZipFile, i) if klass is None: continue self.pathObjmap[i] = self.cd.addItem(self.id, klass, i, zf = self.zf, zo = self, name = pathname, mimetype = mt) doupdate = True # sort our children self.sort(lambda x, y: cmp(x.title, y.title)) if doupdate: StorageFolder.doUpdate(self)