Esempio n. 1
0
        self.bhl2json.generate_id_filename(xml_filename, id_filename)


if __name__ == "__main__":

    # paths = ['/var/www/lildbibio_scielo_org/proc/xml_path/new', '/var/www/lildbibio_scielo_org/proc/xml_path/inproc', '/var/www/lildbibio_scielo_org/proc/xml_path/archive' ]
    # paths = ['/var/www/lildbibio_scielo_org/proc/teste/new', 'i', 't' ]
    # python3 bhl_lilacs.py /var/www/lildbibio_scielo_org/bases/cisis1660 /var/www/lildbibio_scielo_org/bases/bhl/bhl /var/www/lildbibio_scielo_org/proc/bhl_lilacs  /var/www/lildbibio_scielo_org/bases/bhl/bhl_xml
    from utils.parameters import Parameters
    from utils.report import Report
    from configuration import Configuration

    configuration = Configuration("configuration.ini")
    if configuration.check_parameters(["CISIS_PATH", "REPORT_PATH", "INBOX_PATH", "ARCHIVE_PATH", "DB_FILENAME"]):
        cisis_path, report_path, inbox_path, archive_path, db_filename = configuration.return_parameters(
            ["CISIS_PATH", "REPORT_PATH", "INBOX_PATH", "ARCHIVE_PATH", "DB_FILENAME"]
        )

        parameter_list = ["", "source of xml files: new|archive"]
        parameters = Parameters(parameter_list)

        if parameters.check_parameters(sys.argv):
            script, xml_source = sys.argv

            if xml_source != "archived" or xml_source != "new":
                xml_source = "new"

            cisis = CISIS(cisis_path)
            files_set = BHL_Files_Set(inbox_path, archive_path)
            report = Report(report_path + "/_bhl_db.log", report_path + "/_bhl_db.err", report_path + "/_bhl_db.txt")
Esempio n. 2
0
    
    
if __name__ == '__main__':

    #paths = ['/var/www/lildbibio_scielo_org/proc/xml_path/new', '/var/www/lildbibio_scielo_org/proc/xml_path/inproc', '/var/www/lildbibio_scielo_org/proc/xml_path/archive' ]
    #paths = ['/var/www/lildbibio_scielo_org/proc/teste/new', 'i', 't' ]
    #python3 bhl_lilacs.py /var/www/lildbibio_scielo_org/bases/cisis1660 /var/www/lildbibio_scielo_org/bases/bhl/bhl /var/www/lildbibio_scielo_org/proc/bhl_lilacs  /var/www/lildbibio_scielo_org/bases/bhl/bhl_xml
    from utils.parameters import Parameters
    from utils.report import Report
    from configuration import Configuration

    
    configuration = Configuration('configuration.ini')
    if configuration.check_parameters(['CISIS_PATH', 'REPORT_PATH', 'INBOX_PATH', 'ARCHIVE_PATH', 'DB_FILENAME']):
        cisis_path, report_path, inbox_path, archive_path, db_filename  = configuration.return_parameters(['CISIS_PATH', 'REPORT_PATH', 'INBOX_PATH', 'ARCHIVE_PATH', 'DB_FILENAME']) 
        
        parameter_list = ['', 'source of xml files: new|archive' ]
        parameters = Parameters(parameter_list)
    
        if parameters.check_parameters(sys.argv):
            script, xml_source = sys.argv
        
            if xml_source != 'archived' or xml_source != 'new':
                xml_source = 'new'

            cisis = CISIS(cisis_path)
            files_set = BHL_Files_Set(inbox_path, archive_path)
            report = Report(report_path + '/_bhl_db.log', report_path + '/_bhl_db.err', report_path + '/_bhl_db.txt')

            proc = BHL_LILACS(cisis, files_set, report)
        
        
        return filename

    

if __name__ == '__main__':

    
    from utils.parameters import Parameters
    from utils.report import Report
    from configuration import Configuration

    configuration = Configuration('configuration.ini')
    if configuration.check_parameters(['REPORT_PATH', 'INBOX_PATH']):
        report_path, xml_path  = configuration.return_parameters(['REPORT_PATH', 'INBOX_PATH']) 
        
    
        parameter_list = ['', 'replace item', 'replace title', 'start date = iso date | start | current', 'end date = iso date | current ' ]
        parameters = Parameters(parameter_list)
    
        if parameters.check_parameters(sys.argv):
            script_name, rep_item, rep_title, start_date, end_date = sys.argv

            from datetime import  date, timedelta

            curr_date = date.today() - timedelta(days=5)
            next_date = date.today() + timedelta(days=1)
            
            next_date = next_date.isoformat()
            curr_date = curr_date.isoformat()