def author_search(author_key): book_keys = get_books_by_author(author_key) for key in book_keys: t = site.get(key) print key, t.title, '<br>' print ' ', t.isbn_10, '<br>' locs = [] for i in t.isbn_10 if t.isbn_10 else []: for l in search_query('isbn', i): if l not in locs: locs.append(l) for i in t.lccn if t.lccn else []: for l in search_query('lccn', i): if l not in locs: locs.append(l) show_locs(locs, None)
def author_search(author_key): book_keys = get_books_by_author(author_key) for key in book_keys: t = site.get(key) print(key, t.title, '<br>') print(' ', t.isbn_10, '<br>') locs = [] for i in t.isbn_10 if t.isbn_10 else []: for l in search_query('isbn', i): if l not in locs: locs.append(l) for i in t.lccn if t.lccn else []: for l in search_query('lccn', i): if l not in locs: locs.append(l) show_locs(locs, None)
site = get_site() name = sys.argv[1] # example: 'Leonardo da Vinci' author_keys = site.things({'type': '/type/author', 'name': name}) print len(author_keys), 'authors found' edition_keys = set() for ak in author_keys: edition_keys.update(site.things({'type': '/type/edition', 'authors': ak})) print len(edition_keys), 'editions found' locs = set() for ek in edition_keys: e = site.withKey(ek) for i in e.isbn_10 if e.isbn_10 else []: locs.update(search_query('isbn', i)) for i in e.lccn if e.lccn else []: locs.update(search_query('lccn', i)) for i in e.oclc_numbers if e.oclc_numbers else []: locs.update(search_query('oclc', i)) print len(locs), 'MARC records found' def ldv(line): for s in ('1452', '1519', 'eonard', 'inci'): if line.find(s) != -1: return True return False for loc in locs: # print loc data = get_data(loc)