コード例 #1
0
ファイル: elsevier_package.py プロジェクト: GiorgosPa/scoap3
                    pass

            if add_new_pdf:
                try:
                    if exists(join(path, 'main_a-2b.pdf')):
                        record_add_field(rec, 'FFT', subfields=[('a', join(path, 'main_a-2b.pdf')), ('n', 'main'), ('f', '.pdf;pdfa')])
                        self.logger.debug('Adding PDF/A to record: %s' % (doi,))
                    elif exists(join(path, 'main.pdf')):
                        record_add_field(rec, 'FFT', subfields=[('a', join(path, 'main.pdf'))])
                    else:
                        raise MissingFFTError("Record %s doesn't contain PDF file." % (doi,))
                except MissingFFTError, err:
                    register_exception(alert_admin=True, prefix="Elsevier paper: %s is missing PDF." % (doi,))
                    self.logger.warning("Record %s doesn't contain PDF file." % (doi,))

        record_add_field(rec, '583', subfields=[('l', self.get_elsevier_version(find_package_name(path)))])
        record_add_field(rec, 'FFT', subfields=[('a', join(path, 'main.xml'))])
        record_add_field(rec, '980', subfields=[('a', 'SCOAP3'), ('b', 'Elsevier')])
        return record_xml_output(rec)

    def bibupload_it(self):
        print self.found_articles
        if self.found_articles:
            if [x for x in self.found_articles if "vtex" not in x]:
                self.logger.debug("Preparing bibupload.")
                fd, name = mkstemp(suffix='.xml', prefix='bibupload_scoap3_', dir=CFG_TMPSHAREDDIR)
                out = fdopen(fd, 'w')
                print >> out, "<collection>"
                for i, path in enumerate(self.found_articles):
                    if "vtex" not in path:
                        print >> out, self.get_record(path)
コード例 #2
0
ファイル: contrast_out.py プロジェクト: GiorgosPa/scoap3
 def sort_results(self):
     self.found_articles = sorted(self.found_articles, key=lambda x: find_package_name(x['xml']), cmp=contrast_out_cmp)