Project: Library Scan

Specification

Use Cases

I have a hand held barcode reader, that connects to the USB port of my laptop and acts as though I'd typed in the numbers of the barcode at the keyboard. Using this it is fairly easy to scan a shelf of books and end up with a text file containing one ISBN number per line.

What I'd like to end up with is a database describing my library, from which I can generate web pages and interact with via scripts and forms in order to:

  1. Keep track of which books I have - especially useful if I could use my iPhone from a bookshop to check which books in a series I don't have
  2. Help me lend out books to friends - things like ratings, loan history, genre and compatibility with sites like Library Thing or Book Crossing
  3. Help me find, sort and organise my books - thinks like size, format, shelf location, on loan, publication date, date added to database and date last read
  4. In the event of a fire, it would be useful to make an insurance claim then rebuild my library, so price, publisher, URL of info source

Scripts

What I'm going to need are the following scripts:

To build the catalog

isbn2info
Given a single ISBN number return as much info as possible, in a useful format - Moonshadow has already done a majority of the work needed for this in his script that checks a number of sources, such as Amazon, and parses them if the book is successfully found
shelf2info
Given a text file containing ISBNs and optionally some tags at the top, uses isbn2info to create an output file ready to be processed into SQL
info2sql
Given a directory full of output files containing duplicates, errors and books already in the database, updates the database sensibly
isbn2sql
A CGI script allowing you to update the database one book at a time
notfound
A CGI script allowing hand entry of all fields for books without ISBNs
To use the catalog
summary
Use number of books, prices, age and format to estimate cost to buy originally and cost to replace now. Also statistical breakdown by age, genre, reading frequency, etc. Total mass and volume of books.
suggest
Make a suggestion of what to read or re-read next.
onloan
Who still has what, and when they borrowed it.
listing
Nice compact listing of books matching given criteria, suitable for printing out and taking along to a book convention dealer hall.
Interactive use
browse
Generate a form webpage for a single book, allowing update of its fields and navigation to next book by author, genre, title, date, etc.
navigate
Search and navigation interface, suitable for mobile device browsing
manage
Tool to aid mass changes (eg re-shelving authors)

Data formats

Tags / Fields

Loan, reading date and rating history should be kept in a separate table of the database.

No fields may contain tabs, as that is used as a field seperator in files.

Dates are optionally "YYYY" or "YYYY-MM-DD"

Files

Shelf file format is to ignore any lines starting with a # or whitespace, to treat lines starting with a digit as an ISBN and lines starting with a letter as being TAG=VALUE which then apply to all succeeding books

Output file format is tab separated TAG=VALUE pairs, with zero len VALUE ok


Links