A library at home

July 17, 2009

programming

I’ve told a few times about how to build a library.

But there a some extra things that must be done before you can call yourself a complete librarian.

  1. ID-ing the books you have
  2. Storing the information
  3. Marking the books
  4. Sorting and shelving the books
  5. Remembering who borrowed what

ID-ing books

For this I bought a barcode reader that reads the ISBN number of the book’s backcover. With book_get (Perl code) I can retrieve the author, title, genre and year published from Google.

% book_get 9789024546497
Cryptonomicon
Neal Stephenson
none
2005
#Cryptonomicon‎by Neal Stephenson, Irene Ketman - 2005

Getting the genre right is a bit of a problem as Google will not always report the correct genre (or just slightly different, i.e. sometimes ‘science’ and sometimes ‘computer science’). I solved this by explicitly asking for the genre in the next step.

Also the html returned is awful, so sometimes this script looses its way.

Storing the information

Getting the information is the first step, now it needs to be stored somewhere. In a SQLite database for instance. I’ve made a minimal database with only one table which holds all information: title, genre, author, isbn, and a few more items.

With book_sql (perl code) the information retrieved with book_get is normalized (correct the genre) and put into the SQLite db.

Marking the books

To help with this I needed a label writer to print the author, genre and title on a small label. Currently I am not confident enough to automate the printing of the labels so I manually query the database and feed the rows to labelfmt (Perl code). This little scripts uses LaTeX to format the labels and will print the resulting pdf on the labelwriter.

% sqlite3 biblio.db
sqlite> select * from books where title like '%crypto%';
146|9789024546497|Cryptonomicon|Neal Stephenson, Irene Ketman|science fiction|2005|1201339561|

Now I give this text to labelfmt and it will print the label

% ./labelfmt
146|9789024546497|Cryptonomicon|Neal Stephenson, Irene Ketman|science fiction|2005|1201339561|
....

And the labels gets printed:

label with print

Next you will needed:

  • little pieces of thick paper/carton; this is where you sticker the labels on. Like this:

paper with label

  • little (120 x 120 mm) plastic triangles; which can be glued in each book, so that the book’s label can be put inside.

plastic in book

And insert the label:

label in book

And another one is ready :-)

Sorting and storing

We decided to catalog our books based on genre. So I made a map to tell which genres are placed where. Sorta like

  • COMPUTER - left shelve in the living room
  • SCIENCE - middle shelve in the living room
  • … - somewhere else

So there you have it a full blown library setup for you books at home.

Borrowing

Now if somebody want to read one of our book it is simply a matter of: locating the book, getting the label out, writing the person’s name on the label and storing the label in a safe place until the book is returned.

This last step could also be automated by using the barcode reader, but the desktop computer in our living room is not powered on 100% of the time. Booting the machine takes too long and makes it too cumbersome if someone just wants to borrow a book.

Perl