def find_authors(isbn_list, name):
    edition_keys = []
    for isbn in isbn_list:
        edition_keys.extend(site.things({'type': '/type/edition', 'isbn_10': isbn}))
    authors = set()
    for k in edition_keys:
        t = site.withKey(k)
        if t.authors:
            authors.update(t.authors)
    for a in authors:
        if not match_name(a.name, name, last_name_only_ok=False):
            continue
        books = site.things({'type': '/type/edition', 'authors': a.key})
        print(repr(a.key, a.name, a.birth_date, a.death_date, len(books)))
Example #2
0
def find_authors(isbn_list, name):
    edition_keys = []
    for isbn in isbn_list:
        edition_keys.extend(
            site.things({
                'type': '/type/edition',
                'isbn_10': isbn
            }))
    authors = set()
    for k in edition_keys:
        t = site.withKey(k)
        if t.authors:
            authors.update(t.authors)
    for a in authors:
        if not match_name(a.name, name, last_name_only_ok=False):
            continue
        books = site.things({'type': '/type/edition', 'authors': a.key})
        print(repr(a.key, a.name, a.birth_date, a.death_date, len(books)))
Example #3
0
def other_editions(title, wkey, work_author):
    # look for other editions with the same title
    wakey = work_author['key']
    q = {'type': '/type/edition', 'title': title}
    for k in 'works', 'title_prefix', 'key', 'authors':
        q[k] = None
    found = []
    for e in query_iter(q):
        if not e.get('authors', None):
            continue
        if e.get('works', None) and any(i['key'] == wkey for i in e['works']):
            continue
        if any(i['key'] == wakey for i in e['authors']):
            continue
        for akey in (a['key'] for a in e.get('authors', [])):
            a = withKey(akey)
            name = a.get('name', '')
            if match_name(name, work_author['name'], last_name_only_ok=True):
                yield (e, a)
def other_editions(title, wkey, work_author):
    # look for other editions with the same title
    wakey = work_author['key']
    q = { 'type': '/type/edition', 'title': title }
    for k in 'works', 'title_prefix', 'key', 'authors':
        q[k] = None
    found = []
    for e in query_iter(q):
        if not e.get('authors', None):
            continue
        if e.get('works', None) and any(i['key'] == wkey for i in e['works']):
            continue
        if any(i['key'] == wakey for i in e['authors']):
            continue
        for akey in (a['key'] for a in e.get('authors', [])):
            a = withKey(akey)
            name = a.get('name', '')
            if match_name(name, work_author['name'], last_name_only_ok=True):
                yield (e, a)