Nearly three years ago I bought a bar code scanner and threatened to catalog all the books on my shelves. That didn’t happen, unfortunately – nothing to do with having a short attention span and an unhealthy attitude toward keeping books unnecessarily, but definitely because non-subscription ISBN-to-Book-Data APIs were not so great at the time.
At the time of writing, I’m midway through a book purge, making space on the burgeoning shelves so that the new, unread books that reside on the floor can go up in the world. This would usually be no issue. I’ll shift out the books I want to hang onto the least to make room. But, during these plague years, transferring books to second-hand stores has become a little more involved. No more dropping into the second-hand section with crate of crinkly, soft-spined paperbacks and enjoying a relaxed chat with the book nerd tasked with assessing the haul. Now an appointment must be made, and the shops are more focussed on their intake, with instructions on what to bring, or not.
With a stack of forty-odd books to shift, I reckoned the best way to make it easy for the bookshop team was to get the barcode scanner back up and running, bip all the books in the to-go pile, and email the book acquisition team a spreadsheet with enough information to allow them to scratch the books they would not accept.
It also seemed like a good time to record the books I swore I was going to read, and try to focus on reading them before the holidays at the end of the year. Because, I will be asking for more books.
Step 1 - Collect the ISBNs. The barcode scanner does this. Plug it into a computer via a USB cable and it pretends to be a keyboard. Every time you bip, it ‘types’ the ISBN number. This model allows you to bip away like crazy while not connected to a computer, and it will remember the ISBNs (‘inventory mode’). Then you scan a special barcode and it will type all the ISBNs just like you’ve done a big copy-n-paste.
Step 2 - Write some code to query an API with the collected ISBNs and pull the details. This was an issue the last time around, but I found out that the Google Books Volume API is now quite decent for 0- (English, 10 digit) and 1- (English, 13 digit) books. If you pop by book sources at Wikipedia there are more sources, some free, some subscription. The resulting Ruby script lives on Github at isbngrab.
Step 3 - Profit! From the results of labour, that is. There’s an asciicast of the workflow below. The cat
command at the start opens the file ISBNs
for editing and the bipper types in the numbers. I’m pressing Ctrl-D
at the end to close the file, running the script from Step 2 and then showing what is in the output file.
Step 4 - Upload the CSV file to Google Docs, or wherever, and email a public link to the shop so they can check it out.