Usage¶
For the end user several scripts are provided to use from the command line:
$ to_isbn10 ISBN13
transforms an ISBN13 number to ISBN10.
$ to_isbn13 ISBN10
transforms an ISBN10 number to ISBN13.
$ isbn_info ISBN
gives you the group identifier of the ISBN.
$ isbn_mask ISBN
masks (hyphenate) an ISBN (split it by identifiers).
$ isbn_meta ISBN [wcat|goob|openl|merge] [bibtex|...] [YOUR_APIKEY_TO_SERVICE]
gives you the main metadata associated with the ISBN, wcat
uses worldcat.org
(no key is needed), goob
uses the Google Books service (no key is needed),
openl
uses the OpenLibrary.org api (no key is needed), merge
uses
a merged record of wcat
and goob
records (no key is needed) and
is the default option (you only have to enter, e.g. isbn_meta 9780321534965
).
You can enter API keys and
set preferences in the file isbntools.conf
in your
$HOME\.isbntools
directory (UNIX). For Windows, you should look at
%APPDATA%/isbntools/isbntools.conf
. The output can be formatted as bibtex
, csl
(CSL-JSON),
msword
, endnote
, refworks
, opf
or json
(BibJSON) bibliographic formats.
$ isbn_editions ISBN
gives the collection of ISBNs that represent a given book (uses Open Library and LibraryThing).
$ isbn_validate ISBN
validates ISBN10 and ISBN13.
$ ... | isbn_stdin_validate
to use with posix pipes (e.g. cat FILE_WITH_ISBNs | isbn_stdin_validate
).
TIP Suppose you want to extract the ISBN of a pdf eboook (MYEBOOK.pdf). Install pdfminer and then enter in a command line:
$ pdf2txt.py -m 5 MYEBOOK.pdf | isbn_stdin_validate
$ isbn_from_words "words from title and author name"
a fuzzy script that returns the most probable ISBN from a set of words!
(You can verify the result with isbn_meta
)!
$ isbn_goom "words from title and author name" [bibtex|csl|opf|msword|endnote|refworks|json]
a script that returns from Google Books multiple references.
$ isbn_doi ISBN
returns the doi’s ISBN-A code of a given ISBN.
$ isbn_ean13 ISBN
returns the EAN13 code of a given ISBN.
$ isbn_ren FILENAME
renames (using metadata) files in the current directory that have ISBNs in their
filename (e.g. isbn_ren 1783559284_book.epub
, isbn_ren "*.pdf"
).
Enterisbn_ren
to see many other options.
$ isbntools
writes version and copyright notice and checks if there are updates.
With
$ isbn_repl
you will get a REPL with history, autocompletion, fuzzy options, redirection and access to the shell.
Following is a typical session:
$ isbn_repl
Welcome to the isbntools 4.2.2 REPL.
** For help type 'help' or '?'
** To exit type 'exit' :)
** To run a shell command, type '!<shellcmnd>'
** Use '#' in place of the last ISBN
$ isbn> ?
Commands available (type ?<command> to get help):
-------------------------------------------------
BIBFORMATS conf doi editions goom mask to_isbn13
PROVIDERS cover doi2tex exit help meta validate
audit desc ean13 from_words info to_isbn10
$ isbn> meta 9780156001311 tex
@book{9780156001311,
title = {The Name Of The Rose},
author = {Umberto Eco},
isbn = {9780156001311},
year = {1994},
publisher = {Harcourt Brace}
}
$ isbn> meta 9780156001311 tex >>myreferences.bib
$ isbn> !ls
myreferences.bib
$ isbn> desc #
It is the year 1327. Franciscans in an Italian abbey are suspected of
heresy, but Brother William of Baskerville’s investigation is suddenly
overshadowed by seven bizarre deaths. Translated by William Weaver. A Helen
and Kurt Wolff Book
$ isbn> cover #
thumbnail: http://books.google.com/books/content?id=PVVyuD1UY1wC&printsec=frontcover&img=1&zoom=1
smallThumbnail: http://books.google.com/books/content?id=PVVyuD1UY1wC&printsec=frontcover&img=1&zoom=5
$ isbn> exit
bye
Within REPL many of the operations are faster.
Many more scripts could be written with the isbntools
library,
using the methods for extraction, cleaning, validation and standardization of ISBNs.
Just for fun, suppose I want the most spoken about book with certain words in his title.
For a quick-and-dirty solution, enter the following code in a file
and save it as isbn_tmsa_book.py
.
#!/usr/bin/env python
import sys
from isbntools import *
query = sys.argv[1].replace(' ', '+')
isbn = isbn_from_words(query)
print("The ISBN of the most `spoken-about` book with this title is %s" % isbn)
print("")
print("... and the book is:")
print("")
print((meta(isbn)))
Then in a command line (in the same directory):
$ python isbn_tmsa_book.py 'noise'
In my case I get:
The ISBN of the most `spoken-about` book with this title is 9780143105985
... and the book is:
{'Publisher': u'Penguin Books', 'Language': u'eng', 'Title': u'White noise',
'Year': u'2009', 'ISBN-13': u'9780143105985', 'Authors': u'Don DeLillo ;
introduction by Richard Powers.'}
Have fun!