Goodreads+webcam+python+zbar == hackfun!
I am a big fan of GoodReads a social network for people who read books.
I read a lot, and I like that I can see what other people think before starting a book, and I can put my short reviews, and I can see what I have been reading, and lots more.
In fact, goodreads is going to be a big part of a project I am starting with some PyAr guys.
One thing I have been lazy about is adding my book list to goodreads, because it's a bit of a chore.
Well, chore no more!
Here's how to do it, the hacker way...
Get zbar
Get a cheap webcam
Get a book
Get a 7-line python program (included below)
Cute, isn't it?
Here's the code:
A good idea. I am acutally en route to sell some of my old books on the internet and thought about buying a barcode scanner. But this is so obviously a better idea as all my computers have a camera build in. Thanks for the idea!
Glad it was useful :-)
Hi, there Robert!
I've tried your 7-line python script, but I had to do some changes. so your code is working for me now, like this:
import os
p=os.popen('LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so zbarcam /dev/video1','r')
while True:
code = p.readline()
print 'Got barcode:', code
isbn = code.split(':')[1]
os.system('firefox http://www.goodreads.com/se...
In order to use my Creative WebCam Plus, I had to add the line:
"LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so" before "zbarcam" and after it. "/dev/video1" because I'm using the script on a laptop with a built-in webcam, but that's the one I don't want to use, because isn't in focus. The one I want to use is the Creative one, plugged via USB with a ring to focus it.
The other change is the browser.
I don't use Chrome, so I changed "chrome" for "firefox" and everything works like a charm.
Thanks for your script.
I also want to share with you a video I uploaded to YouTube, using Zbar to search any item with a barcode using Google, or another program. I used another tiny program called "crikey" that allow me to use the read barcode anywhere I want....
Here is the videoclip:
http://www.youtube.com/watc...
I got the info from here:
http://www.tuxbrain.com/con...
Now I've got a question. How can I do the same on Windows? I mean, how can I use the read barcode from Zbar, anywhere I want? Is there a way to redirect the output of the webcam to any open search box, active window (NotePad, for example) or search box on any application?
If you've got any idea, please, contact me at fmft71 at yahoo dot es
También hablo y entiendo Español, sin ningún problema.... OK?
Very cool! I'm curious to see if zbar works on Windows or (preferably) OS X. Nice hack!
It seems the webcam support is not available for windows, and the scanner that uses images is much harder to get working right.
When working with video, you just move it around until it clicks, with snapshots it's a pin in the neck.
Thanks a ton, am also reading your PyQT tutorials. There are some typos in tutorials.
do you know how to connect zbar to a database eg google and search and print the deatails found
Actually, yes, we ahve implemented that in Aranduka: http://aranduka.googlecode.com
You want the google_guesser and barcode plugins (integrate branch) for the sample code. Of course, some glue will be required to make them work outside Aranduka.
is there a way of getting this to work on a win box. I copied the code and defined the location of zbar. why am I not able to scan the code. It just does not start the zbar program
kriskrimson@ymail.com