Exemple #1
0
 def _upload_collection(self, coll):
     """Bibupload many records."""
     from invenio.legacy.bibupload.utils import bibupload_record
     bibupload_record(
         collection=coll, file_prefix='community', mode='-c',
         opts=[], alias="community",
     )
     return True
Exemple #2
0
def add_doi_to_record(recid, doi):
    rec = {}
    record_add_field(rec, '001', controlfield_value=str(recid))
    pid_fields = [('a', doi), ('2', 'DOI')]
    record_add_field(rec, tag='024', ind1='7', subfields=pid_fields)

    from invenio.legacy.bibupload.utils import bibupload_record
    bibupload_record(record=rec, file_prefix='doi', mode='-c',
                     opts=[], alias="doi")
    return rec
Exemple #3
0
 def _upload_collection(self, coll):
     """Bibupload many records."""
     from invenio.legacy.bibupload.utils import bibupload_record
     bibupload_record(
         collection=coll,
         file_prefix='community',
         mode='-c',
         opts=[],
         alias="community",
     )
     return True
Exemple #4
0
 def _upload_record(self, rec, pretend=False):
     """Bibupload one record."""
     from invenio.legacy.bibupload.utils import bibupload_record
     if rec is False:
         return None
     if not pretend:
         bibupload_record(
             record=rec, file_prefix='community', mode='-c',
             opts=[], alias="community",
         )
     return rec
Exemple #5
0
 def _upload_record(self, rec, pretend=False):
     """Bibupload one record."""
     from invenio.legacy.bibupload.utils import bibupload_record
     if rec is False:
         return None
     if not pretend:
         bibupload_record(
             record=rec,
             file_prefix='community',
             mode='-c',
             opts=[],
             alias="community",
         )
     return rec
Exemple #6
0
def calculate_preservation_score(recid):
    """Calculate the preservation score of a given record."""
    r = get_record(recid)
    files = r[current_app.config['PRESERVATIONMETER_FILES_FIELD']]
    score = calculate_score(
        [(f['full_name'], f['path']) for f in files]
    )

    marcxml = """<record>
    <controlfield tag="001">{0}</controlfield>
    <datafield tag="347" ind1="" ind2="">
        <subfield code="p">{1}</subfield>
    </datafield>
    </record>
    """.format(recid, score)

    bibupload_record(marcxml)
Exemple #7
0
def control_actions(record, curate=None, archive=None, publish=None):
    rec = {}
    record_add_field(rec, '001', controlfield_value=str(record['recid']))
    if curate is None:
        curate = record.get('record_curated_in_project', False)
    if archive is None:
        archive = record.get('record_selected_for_archive', False)
    if publish is None:
        publish = record.get('record_public_from_project', False)

    project_info_fields = [('a', '%s' % curate)]
    record_add_field(rec, tag='983', ind1='_',
                     ind2='_', subfields=project_info_fields)
    project_info_fields = [('b', '%s' % publish)]
    record_add_field(rec, tag='983', ind1='_',
                     ind2='_', subfields=project_info_fields)
    project_info_fields = [('c', '%s' % archive)]
    record_add_field(rec, tag='983', ind1='_',
                     ind2='_', subfields=project_info_fields)
    from invenio.legacy.bibupload.utils import bibupload_record
    bibupload_record(record=rec, file_prefix='project_info', mode='-c',
                     opts=[], alias="project_info")