Beispiel #1
0
    def scan_all(self):
        self.init_stats()
        self.log_options()
        self.opdsdb=sopdsdb.opdsDatabase(self.cfg.DB_NAME,self.cfg.DB_USER,self.cfg.DB_PASS,self.cfg.DB_HOST,self.cfg.ROOT_LIB)
        self.opdsdb.openDB()
        self.opdsdb.avail_check_prepare()

        for full_path, dirs, files in os.walk(self.cfg.ROOT_LIB, followlinks=True):
            for name in files:
                file=os.path.join(full_path,name)
                (n,e)=os.path.splitext(name)
                if (e.lower() == '.zip'):
                    if self.cfg.ZIPSCAN:
                        self.processzip(name,full_path,file)
                else:
                    file_size=os.path.getsize(file)
                    self.processfile(name,full_path,file,0,file_size)

        self.opdsdb.commit()
        if self.cfg.DELETE_LOGICAL:
           self.books_deleted=self.opdsdb.books_del_logical()
        else:
           self.books_deleted=self.opdsdb.books_del_phisical()
        self.log_stats()
         
        if self.cfg.DUBLICATES_FIND!=0:
           self.logger.info('Starting mark_double proc with DUBLICATES_FIND param = %s'%self.cfg.DUBLICATES_FIND)
           self.opdsdb.mark_double(self.cfg.DUBLICATES_FIND)
           self.log_stats_dbl()

        self.opdsdb.closeDB()
        self.opdsdb=None
Beispiel #2
0
 def __init__(self,cfg,mode=modeCGI):
     self.cfg=cfg
     if mode==modeWSGI:
        self.modulePath=self.cfg.WSGI_PATH
     elif mode==modeINT:
        self.modulePath=''
     else:
        self.modulePath=self.cfg.CGI_PATH
     self.opdsdb=sopdsdb.opdsDatabase(self.cfg.DB_NAME,self.cfg.DB_USER,self.cfg.DB_PASS,self.cfg.DB_HOST,self.cfg.ROOT_LIB)
Beispiel #3
0
    def __init__(self,cfg,mode=modeCGI):
        self.cfg=cfg
        if mode==modeWSGI:
           self.moduleFile=self.cfg.WSGI_PATH
        elif mode==modeINT:
           self.moduleFile=''
        else:
           self.moduleFile=self.cfg.CGI_PATH
        self.modulePath=self.moduleFile
        self.opdsdb=sopdsdb.opdsDatabase(self.cfg.DB_NAME,self.cfg.DB_USER,self.cfg.DB_PASS,self.cfg.DB_HOST,self.cfg.ROOT_LIB)
        self.site_data={'site_title':self.cfg.SITE_TITLE, 'site_subtitle':'Simple OPDS Catalog by www.sopds.ru. Version '+sopdscfg.VERSION,'modulepath':self.modulePath,'site_icon':self.cfg.SITE_ICON,'site_author':self.cfg.SITE_AUTOR,'site_url':self.cfg.SITE_URL,'site_email':self.cfg.SITE_EMAIL, 'charset':'utf-8'}

        self.template1=sopdstempl.opdsTemplate()
        self.opdsWrapper=sopdswrap.baseWrapper(self.cfg, self.template1,self.site_data)

        self.template2=sopdstempl.webTemplate()
        self.webWrapper=sopdswrap.baseWrapper(self.cfg, self.template2,self.site_data)

        self.Wrapper=self.opdsWrapper
Beispiel #4
0
    def __init__(self, cfg, mode=modeCGI):
        self.cfg = cfg
        if mode == modeWSGI:
            self.moduleFile = self.cfg.WSGI_PATH
        elif mode == modeINT:
            self.moduleFile = ''
        else:
            self.moduleFile = self.cfg.CGI_PATH
        self.modulePath = self.moduleFile
        self.opdsdb = sopdsdb.opdsDatabase(self.cfg.DB_NAME, self.cfg.DB_USER,
                                           self.cfg.DB_PASS, self.cfg.DB_HOST,
                                           self.cfg.ROOT_LIB)
        self.site_data = {
            'site_title':
            self.cfg.SITE_TITLE,
            'site_subtitle':
            'Simple OPDS Catalog by www.sopds.ru. Version ' + sopdscfg.VERSION,
            'modulepath':
            self.modulePath,
            'site_icon':
            self.cfg.SITE_ICON,
            'site_author':
            self.cfg.SITE_AUTOR,
            'site_url':
            self.cfg.SITE_URL,
            'site_email':
            self.cfg.SITE_EMAIL,
            'charset':
            'utf-8'
        }

        self.template1 = sopdstempl.opdsTemplate()
        self.opdsWrapper = sopdswrap.baseWrapper(self.cfg, self.template1,
                                                 self.site_data)

        self.template2 = sopdstempl.webTemplate()
        self.webWrapper = sopdswrap.baseWrapper(self.cfg, self.template2,
                                                self.site_data)

        self.Wrapper = self.opdsWrapper