coif

Cover image finder

https://github.com/caltechlibrary/coif

Science Score: 62.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 1 committers (100.0%) from academic institutions
  • Institutional organization owner
    Organization caltechlibrary has institutional domain (www.library.caltech.edu)
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (18.3%) to scientific vocabulary

Keywords

api book book-cover book-covers book-jacket books cover cover-art cover-image isbn python python3
Last synced: 4 months ago · JSON representation ·

Repository

Cover image finder

Basic Info
  • Host: GitHub
  • Owner: caltechlibrary
  • License: other
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 68.4 KB
Statistics
  • Stars: 4
  • Watchers: 5
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
api book book-cover book-covers book-jacket books cover cover-art cover-image isbn python python3
Created over 4 years ago · Last pushed over 4 years ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Support Codemeta

README.md

Coif

Coif (Cover image finder) is a Python 3 module for contacting multiple services to look for a book jacket image given an identifier such as an ISBN.

License Latest release DOI PyPI

Table of contents

Introduction

In a variety of situations involving library software systems, it's useful to show a small image of a book's cover or jacket. Coif (Cover image finder) is a simple Python 3 library that looks for cover images using multiple network services. When it finds one, Coif returns the image in JPEG format.

Coif is most similar to bookcovers, a JavaScript library that performs federated search for book cover images. A Python package similar to Coif is booker, but that one is limited to searching Google Books.

Installation

The instructions below assume you have a Python interpreter installed on your computer; if that's not the case, please first install Python version 3 and familiarize yourself with running Python programs on your system.

On Linux, macOS, and Windows operating systems, you should be able to install coif with pip. To install coif from the Python package repository (PyPI), run the following command: python3 -m pip install coif

As an alternative to getting it from PyPI, you can use pip to install coif directly from GitHub, like this: sh python3 -m pip install git+https://github.com/caltechlibrary/coif.git

Usage

Coif currently offers only an application programming interface (API); it does not offer a command-line interface. The main interface point is the function cover_image(...). Here is a simple demonstration of using it:

```python from coif import cover_image

(url, image) = coverimage('9781479837243') if image: with open('image.jpg', 'wb') as imagefile: image_file.write(image) else: print('Unable to find image') ```

As illustrated above, cover_image returns two values: a URL, and a JPEG image in binary form (if a cover image is found).

Arguments to cover_image

The function takes one required argument, an identifier (preferably an ISBN, but possibly other kinds of identifiers), and additional optional arguments. In more detail, the possible arguments are:

  • identifier (required): an ISBN, OCLC id, LCCN id, OLID and or Open Library Cover ID. Note that only Open Library accepts anything other than ISBN, so your best bet for finding a cover image is to use an ISBN. Conversely, if you provide anything other than an ISBN, cover_image will only contact Open Library.
  • kind (optional): the kind of identifier given as the first argument. Recognized values are isbn, lccn, olid, oclc, and coverid. The default is isbn.
  • size (optional): one of the letters S, M, or L, to indicate a preference for small, medium, or large images, respectively. Some cover images may exist in one size and not another, and there is no way to know in advance which size may be available from a service without actually downloading the image. If a size is provided, cover_image will ask for that size and smaller; for example, if you call it with size = 'M', it will try to find M first and if none exists, it will try S. By default, it wil only try S. If you want to get the largest image you can find, call it with size = 'L'.
  • cc_login (optional): one of the best services for finding cover images is Content Cafè 2 from Baker & Talor, but it requires an account. If you have a user id and password with their service, provide the credentials as a tuple of values ("user", "password") to the optional argument cc_login.

Why cover_image always returns an image

A frustrating aspect of many of the services is that they provide no way to simply ask whether an image exists. If the services do not have an image for a given identifier, most return a small placeholder image (often containing rendered text to the effect of "no cover found") instead of returning a failure code of some kind. Consequently, cover_image must always download images and test them against some size thresholds to determine if it got a placeholder or an actual cover image. This is the reason why the return values from cover_image are both a URL and an image: it has already downloaded the image, so it may as well return it, to save the caller the trouble of downloading the image a second time.

Known issues and limitations

Although the Open Library Covers API accepts multiple types of identifiers such as an ISBN, OCLC, LCCN, and more, other services only accept ISBNs. Thus, while you can pass any of these types of identifiers to Coif, if what you use is not an ISBN, then Coif will only contact the Open Library's service.

Getting help

If you find an issue, please submit it in the GitHub issue tracker for this repository.

Contributing

We would be happy to receive your help and participation with enhancing Coif! Please visit the guidelines for contributing for some tips on getting started.

License

Software produced by the Caltech Library is Copyright © 2021 California Institute of Technology. This software is freely distributed under a BSD/MIT type license. Please see the LICENSE file for more information.

Authors and history

In this section, list the authors and contributors to your software project. Adding additional notes here about the history of the project can make it more interesting and compelling. This is also a place where you can acknowledge other contributions to the work and the use of other people's software or tools.

Acknowledgments

This work was funded by the California Institute of Technology Library.

The vector artwork of a man's coiffure, used as the icon for this project, was created by sarah from the Noun Project. It is licensed under the Creative Commons CC-BY 3.0 license. I edited the logo in Boxy SVG, a native SVG editor for macOS to change the icon color to the orange used by Caltech in their logo.


Owner

  • Name: Caltech Library
  • Login: caltechlibrary
  • Kind: organization
  • Email: helpdesk@library.caltech.edu
  • Location: Pasadena, CA 91125

We manage the physical and digital holdings of the California Institute of Technology, provide services and training, and develop open-source software.

Citation (CITATION.cff)

# YAML 1.2
---
authors: 
  -
    affiliation: "Caltech Library"
    family-names: Hucka
    given-names: Michael
    orcid: "https://orcid.org/0000-0001-9105-5960"
cff-version: "1.1.0"
date-released: 2021-09-10
doi: 
keywords: 
  - book cover
  - book jacket
  - image finder
message: "If you use this software, please cite it using these metadata."
repository-code: "https://github.com/caltechlibrary/template"
title: "Caltech Library Software Repository Template"
version: "1.12.0"
...

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "description": "Cover image finder for books",
  "name": "coif",
  "codeRepository": "https://github.com/caltechlibrary/coif",
  "issueTracker": "https://github.com/caltechlibrary/coif/issues",
  "license": "https://github.com/caltechlibrary/coif/blob/main/LICENSE",
  "version": "0.0.1",
  "author": [
    {
      "@type": "Person",
      "givenName": "Michael",
      "familyName": "Hucka",
      "affiliation": "California Institute of Technology Library",
      "email": ";mhucka@library.caltech.edu",
      "@id": "https://orcid.org/0000-0001-9105-5960"
    }
  ],
  "developmentStatus": "active",
  "downloadUrl": "https://github.com/caltechlibrary/coif/archive/main.zip",
  "keywords": [
    "software",
    "libraries"
  ],
  "maintainer": "https://orcid.org/0000-0001-9105-5960",
  "funder": {
    "@id": "https://doi.org/10.13039/100006961",
    "@type": "Organization",
    "name": "Caltech Library"
  }
}

GitHub Events

Total
Last Year

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 15
  • Total Committers: 1
  • Avg Commits per committer: 15.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
mhucka m****a@c****u 15
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

requirements.txt pypi
  • commonpy >=1.3.10
  • sidetrack >=2.0.0