Archive for the ‘gbs’ Category

Saturday, March 15th, 2008

Free covers for your library, from Google

On Wednesday we added integration with Google Book Search, and talked about it on the main blog. We did it together with a number of cool libraries.

My thoughts are still percolating, but I wanted to throw out a piece of my ham-handed JavaScript code. The code gives your library covers, something libraries usually pay for.

This basic grabs cover images from Google. You feed it an ISBN and it gets the cover. It doesn’t link to them. Would they mind? Maybe.

<div id="gbsthumbnail"></div>

<script type="text/javascript">

/* GBS Cover Script by Tim Spalding/LibraryThing */

function addTheCover(booksInfo)
{
for (i in booksInfo)
{
var book = booksInfo[i];
if (book.thumbnail_url != undefined)
{
document.getElementById('gbsthumbnail').innerHTML =
'<img src="' + book.thumbnail_url + '"/>';
}
}
}

</script>

<script src="http://books.google.com/books?jscmd=viewapi&bibkeys=ISBN:0670880728&callback=addTheCover"></script>

Here’s a version that links to them, but only if they have a full version. Surely they wouldn’t mind this.

<div id="gbsthumbnail"></div>
<div id="gbslink"></div>

<script type="text/javascript">

/* GBS Cover Script by Tim Spalding/LibraryThing */

function addTheCover(booksInfo)
{
var gbsnameA = new Array("No information", "Book info", "Partial view", "Full view");

for (i in booksInfo)
{
var book = booksInfo[i];

var quality = 0;
if(book.preview == "noview") { quality = 1; }
if(book.preview == "partial") { quality = 2; }
if(book.preview == "full") { quality = 3; }

if (book.thumbnail_url != undefined)
{
document.getElementById('gbsthumbnail').innerHTML =
'<img src="' + book.thumbnail_url + '">';
}
if (quality > 3)
{
document.getElementById('gbslink').innerHTML =
"<a href='" + book.preview_url + "'>" + "Google Books: " + gbsnameA[quality] + "</a>";
}
}
}

</script>

<script src="http://books.google.com/books?jscmd=viewapi&bibkeys=ISBN:0670880728&callback=addTheCover"></script>

So, book covers for the price of an occasional link to Google. Sounds like a good deal to me!

If this saves your library money, consider getting LibraryThing for Libraries. We’re clever all over.

Labels: code, gbs, google book search, javascript

Thursday, March 13th, 2008

Google Books in LibraryThing

The official Google Blog and the Inside Book Search Blog just announced the new Google Book Search API, with LibraryThing as one of the first implementors. (The others are libraries; I’ll be posting about what they’ve done over on Thingology.)

In sum, LibraryThing now links to Google Books for book scans—full or partial—and book information.

Google Book Search links can be seen two places:

  • In your catalog. Choose “edit styles” to add the column. The column reflects only the exact edition you have.
  • On work pages. The “Buy, borrow, swap or view” box on the right now includes a Google Books section. Clicking on it opens up a “lightbox” showing all the editions LibraryThing can identify on Google Book Search.

Despite the screenshot, of Carroll’s Through the looking glass and what Alice found there, relatively few works have “full” scans. “Partial view” and “book information” pages are more common. But the former generally include sthe cover and table of contents, and the whole text can be searched. The latter can also be useful for cataloging purposes. Members with extensive collections from before 1923—the copyright cutoff—will get relatively more out the feature.

Leave comments here, or come discuss the feature on Talk.

Limitations. The GBS API is a big step forward, but there are some technical limitations. Google data loads after the rest of the page, and may not be instant. Because the data loads in your web browser, with no data “passing through” LibraryThing servers, we can’t sort or search by it, and all-library searching is impossible. You can get something like this if you create a Google Books account, which is, of course, the whole point.

LCCN and OCLC. To get the best results, we needed to add full access to two library standards, namely Library of Congress Control Numbers (LCCN) and OCLC Numbers. We did so, reparsing the original MARC records where necessary. You can see these columns in your catalog now—choose “edit styles” as above. The two columns are not yet editable, but will be so in a day or two.

The Back Story. The rest of the first batch are libraries, including a number of “friends”–Deschutes Public Library, the Waterford Institute of Technology, the University of Huddersfield and Plymouth State/Scriblio. Google wanted help finding potentials and if there’s one thing I have it’s a Rolodex of smoking-hot library programmers! Once I’ve taken in all the neat things they did, I’ll be posting over on Thingology.

Some libraries have chosen to feature Google Book Search links only when Google has the full scan. This makes sense to me. Linking to a no scans or partial scan, when the library has the item on its shelves, seems weird to me.

LibraryThing and its members can also like to take credit for moving the API along in another way. Your help with the Google Book Search Search bookmarklet forced the issue of GBS data. The message to Google was clear: our members wanted to use GBS with LibraryThing, and if Google wouldn’t provide the information, members would get it themselves. After some to-and-fro with Google, we voluntarily disabled the service. But I think it moved the openness ball a few feet, and that’s something for members to be proud of.

Labels: gbs, google, google book search