예제 #1
0
    def __setexcludedscanfolders__(self, ignoredirlist):
        configdir = os.path.join(self.path, 'Config')
        configfile = os.path.join(configdir, 'main.cfg')
        parser = myutils.parseConfig(configdir, configfile)

        if not parser.has_section('Scan'):
            parser.add_section('Scan')
        if not parser.has_option('Scan', 'ignoredirlist') or ignoredirlist != self.__ignoredirlist__:
            parser.set('Scan', 'ignoredirlist', '|'.join(ignoredirlist))
            self.__ignoredirlist__ = ignoredirlist
        else:
            self.__ignoredirlist__ = parser.get('Scan', 'ignoredirlist').split('|')
        with open(configfile, 'wb') as mainconfig:
            parser.write(mainconfig)
예제 #2
0
    def __setscanfolderRE__(self, scanfolderRE):
        configdir = os.path.join(self.path, 'Config')
        configfile = os.path.join(configdir, 'main.cfg')
        parser = myutils.parseConfig(configdir, configfile)

        if not parser.has_section('Scan'):
            parser.add_section('Scan')
        if not parser.has_option('Scan', 'scanfolderRE') or scanfolderRE != self.__scanfolderRE__:
            parser.set('Scan', 'scanfolderRE', scanfolderRE)
            self.__subjectfolderRE__ = scanfolderRE
        else:
            self.__scanfolderRE__ = parser.get('Scan', 'scanfolderRE')
        with open(configfile, 'wb') as mainconfig:
            parser.write(mainconfig)
        self.__scanfolderREC__ = re.compile(self.__scanfolderRE__)