Git Product home page Git Product logo

librarian's Introduction

README FIRST

Requires some flavour of Linux and Python. Windows users will have to figure out how it works themselves and edit the code to suit.

Also requires the python packages:
biblio
zbar
copy
pygtk
gtk
amazonlookup - For CD barcode lookup
MySQLdb - For MySQl database or
sqlite3  - For sqlite database
reportlab - For PDF report generation
qrencode - For QR code generation

Get the code with:

git clone git://github.com/EvansMike/librarian.git

Install with

python setup.py install

I wanted to catalog all my books using their barcodes as input and track who borrows my books. That’s all. I looked online 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 webcam. The scan triggers a lookup on the database and the book details are downloaded then commited to the local database.

It uses MySQL or sqlite. 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. 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.

QR Codes

Everytime you scan a book a QRcode can be generated. You may not want this behaviour. BY default the behaviour is turned off in the config file. It seemed like a good idea at the time but I admit to never have used the QRcodes for anything. :)

Older books without bar codes can be manually input via the Query/Edit book window. It’s a bit of a pain though if you have lots of books.

DB Notes

To get a list of borrowed books from mysql:

SELECT o_date, title, author, borrowers.name
  FROM borrows, borrowers, books
  WHERE borrows.borrower = borrowers.id
  AND books.id = borrows.book
  AND borrows.i_date IS NULL;

The sqlite2 database file is created from the database.schema.sql file with:

./mysql2sqlite3 --no-data  -p books | sqlite3 database_schema.db

Update: 2012-04-12

You can now scan DVDs and CDs provided you have a Amazon web services account. http://aws.amazon.com to sign up. As far as I know, low useage will attract no charge, likely to be most domestic users. CD lookup uses Amazon to get CD data from the barcode, if it’s not in Amazon’s database this will fail. Not sure what other databases there are for CD case barcodes. Perhaps an application to add CD’s as they are played using freedb?

Setting user database password stuff is up to you for the moment. I will add a GUI. NOTE: Passwords are stored as plain text in the config file. 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.

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.

To get who borrowed what and for how long:

  SELECT title, name, DATEDIFF(i_date,o_date) AS days
      FROM borrows, borrowers, books
      WHERE borrows.borrower=borrowers.id
      AND books.id=borrows.book;

Windows Users

Apologies to MS Windows, amd Mac users, I don’t use MS Windows or a Mac myself so I have no way to develop or test code other than on Linux. You will have to adapt the code to suit.

Stuff that need fixing for MS Windows include zbarcam code in guiscan.py, database connections to anything other than MySQl and sqlite3 is also not currently supported.

librarian's People

Watchers

James Cloos avatar Vladimir Donets avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.