I wanted to catalogue all my books using their barcodes as input and track who borrows my books. That’s all. I looked on-line for a program that would do just that and couldn’t find any that supported barcode input. The idea of typing in book details didn’t appeal, so wrote this.
This is a simple application to catalogue your library using the ISBN barcode and the zbarcam application with an ordinary web-cam, originally. Lately I added a Wasp barcode scanner. If the software detects this then this is used. The scan triggers a lookup on the database and the book details are downloaded then committed to the local database after giving the user the chance to edit some fields.
Requires some flavour of Linux and Python >= 3.0. Windows users will have to figure out how it works themselves and edit the code to suit.
Requirements can be installed by running:
pip install -r requirements.txt
Get the code with:
git clone https://github.com/EvansMike/librarian.git
Install with: (On a Fedora system).
python setup.py install
or
pip3 install .
Or run it from here with
python3 -m src.librarian
If you want run a Zebra | Wasp style USB scanner, set it up as a keyboard input device. Add yourself to the dialout and input groups.
It uses MariaDB MySQL at the moment. The database config file is created if none exists.
Use database.schema.sql, after creating the database, to populate the database with the required tables
mysql -p books < database.schema.sql
You have to create the database first using your favourite method/tool. The database name (books in the example above) can be anything as long as the config file matches. If the config file contains a password so take care to make it secure from prying eyes.
Can also use sqlite. But don’t because the sqlite code is way out of date. Edit db_conf.cfg to use whatever database you like. Sqlite is easier to set up but not so useful if you want to access the data from multiple computers.
Note
|
The current state of the sqlite code needs updating and probably will not work as is. |
The sqlite2 database file is created from the database.schema.sql file with:
./mysql2sqlite3 --no-data -p books | sqlite3 database_schema.db
Note again: though that the sqlite code is way behind and out of sync with the MySQL code. Contributions are welcome.
Setting user database password stuff is up to you for the moment. I will add a GUI one day. On first run a default ~/.db_config.cnf file is written in your home directory, note that this is a hidden dot-file. This must edited with the details of your database plus any other preferences listed. NOTE: Passwords are stored as plain text in the config file, DON’T reuse passwords!
To create the tables you will need the books_schema.sql file from the sources. After creating the database run:
mysql -p books < books_schema.sql
to create the tables. The -p is required if your DB is password protected. Obviously you can call the DB anything you like, it doesn’t have to be books, as long as the .db_config.cfg file contains matching details.
You will obviously need an internet connection. Start the application and press SCAN NEW button on the left had side. This pops up a new window, if you have a real scanner scan a book’s ISBN barcode. The text window should be populated with either the book’s details, or some other message. To add the book press the ADD button. This opens a new dialog with several fields filled in.
Hit the CLOSE button to add the book|DVD to the database. A print dialog will popup to print a bookmark. I use an Epson receipt scanner to print my bookmarks. But any printer should work just fold or cut the page to fit.
Double clicking on a book in the list opens the Edit Book dialog.
All other buttons should be self-explanatory.
-
Adding a dewy-decimal number.
-
Ideas welcome.
I’m no longer using https://www.upcdatabase.com for UPC lookups for DVDs.
It now uses https://api.upcitemdb.com and requires no API key for the free version. It is rate limited to 100 queries per day but this is likely to suffice for most users.
I’ve added a fun option to print bookmarks. This is so that I can insert them into books I’m lending out and includes the lent data and a reminder to return the book after reading. Enable the print option in the ~/librarian.cfg file.