def main():
    bibupload = ChunkedBibUpload(mode='c', user=SCRIPT_NAME, notimechange=True)
    bibindex = ChunkedBibIndex(indexes='collaboration', user=SCRIPT_NAME)

    def cb_process_one(recid):
        bibupload.add(create_our_record(recid))
        bibindex.add(recid)

    recids = perform_request_search(p='710__g:/.+/')
    loop(recids, cb_process_one)
def main():
    bibupload = ChunkedBibUpload(mode='c', user=SCRIPT_NAME, notimechange=True)

    def cb_process_one(recid):
        tags_520 = get_fieldvalues(recid, '520__a')
        if len(tags_520) > len(set(tags_520)):
            print 'processing %s' % recid
            bibupload.add(create_our_record(recid))

    loop(all_recids(), cb_process_one)
def main():
    bibupload = ChunkedBibUpload(mode='c', user=SCRIPT_NAME, notimechange=True)
    bibindex = ChunkedBibIndex(indexes='author', user=SCRIPT_NAME)

    def cb_process_one(recid):
        xml = create_our_record(recid)
        bibupload.add(xml)
        bibindex.add(recid)

    recids = perform_request_search(p='700__u:"lisbon, lifep" or 100__u:"lisbon, LIFEP"')
    loop(recids, cb_process_one)
def main():
    refextract = ChunkedRefextract(user=SCRIPT_NAME)

    def cb_process_one(recid):
        record = get_record(recid)
        if record.find_fields('999C5') or record.find_fields('999C6'):
            return
        if record_has_fulltext(recid):
            refextract.add(recid)

    loop(all_recids(), cb_process_one)
def main():
    bibupload = ChunkedBibUpload(mode='c', user=SCRIPT_NAME, notimechange=True)
    bibupload2 = ChunkedBibUpload(mode='d', user=SCRIPT_NAME, notimechange=True)
    bibindex = ChunkedBibIndex(indexes='subject', user=SCRIPT_NAME)

    def cb_process_one(recid):
        create_our_record(recid, bibupload, bibupload2)
        bibindex.add(recid)

    #recids = perform_request_search(p='650172:pacs')
    recids = perform_request_search(p='6507_2:pacs')
    loop(recids, cb_process_one)
def main():
    bibrank = ChunkedBibRank(methods='citation', user=SCRIPT_NAME)

    def cb_process_one(recid):
        print 'processing', recid
        try:
            rec = get_record(recid)
        except UnicodeDecodeError:
            pass
        else:
            if len(rec.find_fields('773__')) > 1:
                bibrank.add(recid)


    loop(all_recids(), cb_process_one)
def main():
    bibupload = ChunkedBibUpload(mode="d", user=SCRIPT_NAME, notimechange=True)

    def cb_process_one(recid):
        record = get_record(recid)
        instances = record["035"]

        for field in instances:
            if "SPIRESTeX" in field.get_subfield_values(code="9") and field.get_subfield_values(code="z")[0].startswith(
                ":"
            ):
                new_record = BibRecord(recid=recid)
                new_record["035"] = [field]
                bibupload.add(new_record.to_xml())

    recids = perform_request_search(p="035:spirestex 035__z::*")
    loop(recids, cb_process_one)