More changes to LibraryLookup

My LibraryLookup script for the San Francisco Public Library has been returning a lot of false positives lately. I finally managed to sit down and address that issue, in addition to some other general maintenance. You can grab version 1.5 of the script at its new, permanent page under “Odd Bits.”

It turns out that the SFPL’s advanced search application will return false positives for nearby ISBN numbers if the one you’re searching for is not available in the system. I’ve now modified the script to do a more reliable two-phase search, where it only checks the advanced results if it detects a positive hit using the basic search first.

The script will also now take you to the more user-friendly basic search results page every time, even though it still uses the advanced search to check all of the branch libraries.

I’ve removed the XISBN functionality, which was designed to check other, “related” ISBN numbers if the one you’re looking at wasn’t found. This was a good idea in theory, but it seemed to return too many inappropriate results: If I’m searching for a book, I’m not necessarily interested in the large-print edition, or the audiobook, etc. Searching for these things just caused a lot of inappropriate and unnecessary queries. What removal of this function means, however, is that you’ll need to check the hardcover and paperback editions separately (but that often seemed to be the case before, anyway).

One feature I added was the ability to spot new books that are on order at the library but have yet to actually arrive. This can give you the chance to click over to the library and reserve your copy, even though the book isn’t actually in stock yet.

The other positive change is that I went through and did a thorough housekeeping on the code, which I probably should have done in the first place. I’ve eliminated the unorthodox and inconsitent indentation and line breaks and generally cleaned up the source, which should make it a lot easier to maintain in the future.

Let me know what you think!