[Alexandria-list] Generic barcode scanner / ISBN list import support
Cathal Mc Ginley
cathal.alexandria at gnostai.org
Sun Jun 22 13:49:31 EDT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sat, 21 Jun 2008 17:03:19 +0200
Andreas Kotes <count-linux at flatline.de> wrote:
> Hello,
>
Hi, I'm Cathal and I wrote some of the current CueCat barcode code.
> hmm - I haven't worked with ruby or similiar so far, so I'm having
> slight troubles in getting my head digging into the code ...
>
FYI, the relevant file to work from is lib/alexandria/scanners/cuecat.rb
> ... could someone build a more generic/modular barcode scanner
> integration so other implementations could happen in-line with the
> current/planned architecture? I don't want to mess it up or duplicate
> work.
Actually, grabbing input from an ordinary USB barcode scanner is quite
easy, and the work is pretty much trivial... except....
Well, barcode scanners present the barcode information as if it were
characters input rapidly from a keyboard. The trick is knowing when the
barcode has finished scanning (not all barcodes are the same length).
For an unmodified CueCat, it's easy, since we read in 4 base-64-encoded
strings separated by dots and terminated by a CRLF; we just tokenize
the whole input string using the dots, use the third and fourth fields,
and discard the rest.
For other scanners, there may be a single terminating CRLF,
or two CRLFs, or no terminator at all - then there is no easy way to
tell when we can accept the data as a completed barcode (except, I was
thinking, by waiting for a pause in the rapid input of characters).
>
> My functional requirement would be getting list of (scanned) ISBNs
> into Alexandria to catalog my library, but I'm willing to put some
> work in as time permits ..
>
If your barcode scanner terminates scans with some newline character,
you could always just scan your ISBNs into a text file, and then import
a list of ISBNs. A crude workaround, but it should do the trick.
On the other hand, if you know exactly what characters your scanner
produces, (especially if it uses a newline terminator) it would be a
matter of a few minutes' work for me to write a GenericBarcodeScanner
class to work with it.
Try to find me on Jabber sometime, gnostai at gmail.com, usually evenings
and nights GMT.
> Br - and thanks for this nice software!
>
> Andreas
>
Cheers,
- C.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: GnuPT 2.6.2.1 by EQUIPMENTE.DE
iD8DBQFIXpC3fMAUnRdb+8oRAtVMAJ43PalCJx9uMvtiyy2PmIDgiOr2aACggan9
D2W81oD0p8bla0tOSuVKq98=
=MqtS
-----END PGP SIGNATURE-----
More information about the Alexandria-list
mailing list