Fun With Barcodes

Fun With Barcodes

If you have an Android phone, odds are that you have the Barcode Scanner app. And if you’ve looked in the settings, you may have noticed one called “Custom Search URL”.

This is, as the name says, a URL you can fill in. Once you do, you’ll get a “Custom search” button at the bottom of the screen when you scan a barcode. A “%s” in the URL will be replaced by the numeric UPC value, and “%f” with its format (which is displayed next to the code when you scan one).

It seems to me that this can be used as a poor man’s plugin API. You can use http://www.mydomain.org/barcode?f=%f&s=%s, and make barcode be a CGI/PHP/whatever script that looks at the format and code and decides what to do.

For instance, $EMPLOYER has barcoded asset tags on all inventory items. So today I was able to scan a machine’s code and be redirected to the inventory web page for that machine.

Likewise, if it’s an EAN-13 code that begins with 978 or 979, then presumably it’s an ISBN or ISMN, and you can look it up at Amazon, your library, or wherever.

As far as I know, you can’t recognize that a UPC corresponds to a CD or DVD, without having a table of every CD/DVD publisher, but there’s nothing that says your script has to only do redirection; you can present a list of links to the user. So anyway, for CDs, you can construct MusicBrainz or Discogs lookup URLs. Or perhaps you can parse the code, get the manufacturer, and based on the user’s choice, remember what sort of item that manufacturer corresponds to. Over time you can build up a “good enough” database of the things you scan most often.

I wouldn’t mind having a properly organized library of books, CDs, etc. Which is kind of the point of looking this data up on the net in the first place. But while a phone may make a serviceable barcode scanner, it’s no good for lengthy data input. So really, what I’d like would be for the script to remember what I’ve scanned, along with a quick and dirty readable reference (e.g., “ISBN such-and-such: The Wee Free Men by Terry Pratchett) and stash that someplace so that I can later go back and import the data into Koha or whatever I’m using.

Of course, since it’s a web page, I’m guessing you have access to the full range of goodies that people put in browsers these days. I’m thinking of geographical location, in particular. So the script could in principle behave differently based on where you’re located at the moment (e.g., at home or at work).

There are lots of possibilities. Must. Explore.

One thought on “Fun With Barcodes

  1. One thing that surprises me about the barcode scanner apps is how sensitive they are to low light situations (which are common when you’re scanning barcodes for things on shelves). IIRC, the Android API has a “run autofocus and give me a frame if autofocus succeeded” API, and I suspect that they’re calling that and getting repeated AF failures.

    I keep thinking I want to try to get some good binarizing logic written and just try to pull the barcode from the stream, but that requires me setting up the Android SDK and learning Java. Of course, being a computer vision guy, that’s the only part of it that interests me. As soon as I had it capturing the image, I’d wander off and not add useful features like “look up what the barcode maps to” that make the whole exercise worthwhile.

    1. I suppose the algorithm lover in me would like to better understand how one extracts a barcode from an image, but in practice, I’m much more likely to use someone else’s image-processing library and use it to look stuff up.

      So I guess what I’m saying is “Hey! You got your chocolate in my peanut butter!”

  2. As far as I know, you can’t recognize that a UPC corresponds to a CD or DVD, without having a table of every CD/DVD publisher, but there’s nothing that says your script has to only do redirection; you can present a list of links to the user. So anyway, for CDs, you can construct MusicBrainz or Discogs lookup URLs.

    ICYC for at least these two items an OpenDB plugin developer used Amazon and DVD Empire as the source store. I never checked to see if someone had done something similar for books – after I finished cataloging the DVDs my barcode scanner went poof and the project is waiting for someone to donate a couple of round tuits.

  3. I’m looking for an Android app that does the following: Scan a CD’s barcode, the barcode is recognized providing information about the CD Title, Artist, and song list on the CD, and store all of that information in a database that is searchable. I’d also like to be able to enter information manually (for those CDs not recognized or that don’t have a barcode), and to be able to export the database (to a .CSV file, for instance).

    I’ve looked at probably a dozen apps, and some of them do a piece of all the above, but most disappointingly, those that provide a song list seem to recognize the fewest CDs.

    I’m not a programmer, and am willing to pay a reasonable amount for an app that does what I need …. any suggestions?

Comments are closed.