Skip to content

A web based program to allow you to easily barcode scan all of your library into a website. From there you can easily manage, organize and search your books

Notifications You must be signed in to change notification settings

gspweim/book_collection

Repository files navigation

📚 Biblio: Personal Library Scanner & Manager

A Python-powered tool to scan your physical books into a beautiful web interface using the Open Library API.


🛠 Prerequisites

Before starting, ensure you have the following installed:

  • Python 3.10+
  • MySQL or MariaDB
  • A hardware barcode scanner or a way to generate text files of ISBNs/Barcodes.

⚙️ Installation & Setup

1. Database Setup

Create a database named biblio. The program will automatically handle table and field creation upon first run.

CREATE DATABASE biblio;

2. Configuration

Copy the sample configuration file and update it with your local paths and database credentials:

cp create.json.sample create.json

Edit create.json:

{
    "ROOMS_DIR" : "/home/your_user/path_to_room_textfiles/",
    "EMAIL" : "your_email@example.com",
    "DB_CONFIG": {
        "host": "localhost",
        "user": "dbuser",
        "password": "dbpassword",
        "database": "biblio"
    }
}

3. API Identity

Open fetch_book_data.py and update the headers section with your email address. This identifies your requests to Open Library to ensure reliable API access:

headers = {
    'User-Agent': 'BiblioLibraryManager/1.0 (your_email@example.com)'
}

4. Virtual Environment

Setup a clean environment and install dependencies:

# Create and activate environment
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install requirements
pip install -r requirements.txt

📖 How to Scan & Organize Books

The system organizes books by "Rooms." Each room should have its own .txt file containing barcodes or IDs (one per line).

  1. Create text files named after your rooms (e.g., Office.txt, Kitchen.txt).
  2. Scan your barcodes directly into these files.
  3. Supported Formats:
    • Barcode/ISBN: Simply paste the number.
    • Open Library ID: Paste the ID (e.g., OL26242482M). If using a "Work" ID, follow it with the word works (e.g., OL26242482M works).

🚀 Data Processing Pipeline

Follow these steps in order to populate your library:

Step 1: Load Raw Barcodes

This reads your text files and populates the initial database tables.

python3 load_raw_books.py

Check for an errors.txt file after running. If it exists, review it for formatting issues.

Step 2: Fetch Book Metadata

This calls the Open Library API to retrieve titles, authors, and cover images.

python3 fetch_book_data.py

Note: If a book is missing from Open Library, it will appear in errors.txt. You can manually find the Open Library ID on their website and add it to your room file to try again.


🌐 Using the Web Interface

Once your data is loaded, launch the Flask management site:

cd book_sites
python3 app.py

The terminal will provide a local URL, typically: http://127.0.0.1:5000


🛠 Troubleshooting

  • Missing Covers: Open Library does not have every barcode. If a book fails to load, try searching the Open Library website for the ISBN or Work ID manually.
  • Database Errors: Ensure the dbuser has ALL PRIVILEGES on the biblio database.

About

A web based program to allow you to easily barcode scan all of your library into a website. From there you can easily manage, organize and search your books

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published