def add_cover_image(key, ia): if has_cover_retry(key): print key, 'has_cover' ret = find_img(ia) print 'cover image:', ret post(key, ia, ret)
def add_cover_image(key, ia): if has_cover_retry(key): print key, 'has_cover' return cover_url = 'http://www.archive.org/download/' + ia + '/page/' + ia + '_preview.jpg' post_data = urllib.urlencode({"url": cover_url}) if key.startswith('/b/'): key = '/books/' + key[3:] ol._request(key + "/add-cover.json", method="POST", data=post_data) return ret = find_img(ia) if not ret: return print 'cover image:', ret post(key, ia, ret)