from __future__ import print_function from catalog.infostore import get_site from catalog.olwrite import Infogami from catalog.read_rc import read_rc rc = read_rc() infogami = Infogami(rc['infogami']) site = get_site() # throwaway bit of code for deleting bad scan records # BPL can't scan microtext keys = site.things({'type': '/type/scan_record', 'locations': '/scanning_center/MBMBN/BPL1MI', 'scan_status': 'NOT_SCANNED'}) while keys: for key in keys: sr = site.withKey(key) print(key) q = { 'key': key, 'type': { 'connect': 'update', 'value': '/type/delete' }, } ret = infogami.write(q, comment="can't scan microtext") assert ret['status'] == 'ok' keys = site.things({'type': '/type/scan_record', 'locations': '/scanning_center/MBMBN/BPL1MI', 'scan_status': 'NOT_SCANNED'})
from __future__ import print_function import web import re import sys from catalog.read_rc import read_rc from catalog.infostore import get_site #from catalog.db_read import get_things, withKey from catalog.amazon.other_editions import find_others rc = read_rc() re_translation_of = re.compile('^Translation of\b[: ]*([^\n]*?)\.?$', re.I | re.M) site = get_site() def isbn_link(i): return '<a href="http://wiki-beta.us.archive.org:8081/?isbn=%s">%s</a> (<a href="http://amazon.com/dp/%s">Amazon.com</a>)' % ( i, i, i) def ol_link(key): return '<a href="http://openlibrary.org%s">%s</a></td>' % (key, key) def search(title, author): q = {'type': '/type/author', 'name': author} print(q) authors = site.things(q) print(authors)