Skip to main content

A Python library for interacting with a Calibre ebook library.

Project description

PyCalibre

PyCalibre is a Python library designed to facilitate interaction with a Calibre ebook library. It provides a set of classes and methods to manage ebooks, their metadata, and the library structure efficiently.

Features

  • Load and manage your Calibre library.
  • Add and remove books from the library.
  • Search and retrieve book information.
  • Handle ebook metadata with ease.

Installation

To install PyCalibre, you can use Poetry. First, ensure you have Poetry installed, then run:

poetry install

Usage

To use PyCalibre, you can start by importing the library and initializing your Calibre library instance. Here’s a simple example:

from pycalibre import Library

with Library("path/to/library") as library:
  # Do stuff here

The Library class acts as a context manager, so you don't need to worry about cleaning up.

You can then easily find books in your library by different criteria:

# ... within a Library context
books = library.find_books(author="Austen")
for book in books:
  print(book.title)

Updating books is straightforward as well:

book.update(title="New title", add_tags=["New Tag"], remove_tags=["Old Tag"])

You can work with custom columns as if they were native ones:

print(book.my_custom_column)
book.update(my_custom_column="Hello")

You can also get all the formats of a book:

for fmt in book.get_formats():
  with open(fmt.file_path, 'rb') as f:
    contents = f.read()

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any enhancements or bug fixes. My main motivation in making this package is to help me write maintenance and analysis scripts for my Calibre library, but I am happy for it to be extended to support the needs of others.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycalibre-0.1.0.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycalibre-0.1.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file pycalibre-0.1.0.tar.gz.

File metadata

  • Download URL: pycalibre-0.1.0.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.4 Windows/11

File hashes

Hashes for pycalibre-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3314a5af13d4e84fc73fc7cc4379b58e80e0c6738071aabd4338ffa449680df5
MD5 7045a15e3cf515524a962628ed67e92d
BLAKE2b-256 22cf4e2b7c7f96dd75bbf051e181eaf0eb9707e762e76d3ce497c3e1675751af

See more details on using hashes here.

File details

Details for the file pycalibre-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pycalibre-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.4 Windows/11

File hashes

Hashes for pycalibre-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36b05cc8e49ade49089a0d50a3ef86d802e1e861a03794e0b11bd3a38e178ba2
MD5 0fa8446e8ff9b48dbcaf859ef15b821c
BLAKE2b-256 3cdbf0e21579762cc74b4b09ff0e75e5ffdfdf990c93e6aa784d287d23821476

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page