Exemple #1
0
    def get_f_list(self):

        '''
        write to self.flist according to filters
        '''

        for f in self.avail_f:
            for ignore in self.ignore:
                if type(ignore) == str:
                    if ignore.find('/') >= 0:
                        if basename(f) == ignore:
                            f = None
                    else:
                        if f == ignore:
                            f = None
                else:
                    if ignore.search(f):
                        f = None
            if not f:
                continue
            if (self.fullname and self.fullname.search(f)) \
                    or (self.bname and self.bname.search(basename(f))):
                self.flist.append(f)
            else:
                mtype = cli.mimeof(f)
                for mime in self.mimes:
                    if mtype == mime:
                        self.flist.append(f)
                        break
        self.classify_files()
Exemple #2
0
 def get_data_f(self):
     for f in self.avail_f:
         mtype = cli.mimeof(f)
         for cond, typ in self.crvar['data'].items():
             if mtype == cond or (type(cond) != str and cond.search(f)):
                 if len(typ) == 0:
                     typ = ['data', 0o644]
                 if len(typ) == 1:
                     if type(typ[0]) == int:
                         typ = ['data', typ[0]]
                     if type(typ[0]) == str:
                         typ = [typ[0], 0o644]
                 self.instl_target[f] = typ