Skip to main content

Lib2OPDS

lib2opds generates static OPDS (version 1.2) catalog for local ebook and audiobook library.

Features

  • Directory hierarchy support
  • Virtual directories/shelves: new books, authors, languages, decade issued, etc.
  • ePUB format: metadata extraction, thumbnail generation
  • PDF format: metadata extraction, thumbnail generation
  • Audiobook M4B format: metadata extraction, thumbnail generation
  • "Lazy" updating of feeds. lib2opds re-generates feeds only when new files are added into the library
  • Sidecar files for metadata extraction
  • Global and local configuration files as well as command line options
  • Caching for better processing of libraries with many books
  • Static site generation: with additional HTML file per feed or with client-side XSLT processing for the feed XML files (like for RSS/Atom feeds)

How to install

lib2opds is distributed on PyPI. The best way to install it is with pipx.

$ pipx install lib2opds

How to use

Please read the manual frist:

$ man lib2opds

Let's consider the following library directory:

$ tree ./test-library/
./test-library/
├── Linux
│   └── How Linux Works - Brian Ward.epub
└── Science Fiction
    ├── All Systems Red.epub
    └── I, Robot - Isaac Asimov.epub

Generate OPDS catalog and complimenting HTML site for the library directory:

$ lib2opds --opds-base-uri "/opds/" --library-base-uri "/library/" --library-dir "./test-library" --opds-dir "./output" --generate-site-xslt

Get the following result:

$ tree ./output/
./output/

├── assets
│   ├── acquisition-feed.xsl
│   ├── navigation-feed.xsl
│   └── style.css
├── covers
│   ├── a965b65e-85f9-4e98-a02b-4ff316869a2c.jpg
│   └── d738ea6d-f205-45e6-b09d-17d9b95c0286.jpg
├── feeds
│   ├── 142ccd52-436c-402f-8094-524fb20af9d3.xml
│   ├── 414562bf-c592-47f3-a94d-b01120ee22ca.xml
│   ├── 44d48843-196b-409b-9bd9-67d928505121.xml
...
│   └── fab6423d-a3ea-4027-8d84-b372fbef4503.xml
└── index.xml

/etc/lib2opds.ini is used by default and options can be overridden via command line arguments. See $ man 5 lib2opds.ini for more details.

Now it is possible to serve it with any HTTP server. Example of configuration file for Nginx with HTTP Basic Authentication:

location /library {
        auth_basic  "Library Area";
        auth_basic_user_file /etc/nginx/htpasswd;
        alias /library-dir-path;
}

location /opds {
        auth_basic  "Library Area";
        auth_basic_user_file /etc/nginx/htpasswd;
        alias /opds-dir-path;
        index index.xml;
}

Notice: There might be issues with some e-book reader software because of the library location protected with basic auth.

Sidecar files

lib2opds detects sidecar files for the target e-book file and extracts metadata and cover from them.

For example, in case of some-book.epub e-book file lib2opds will try to check for some-book.info and some-book.cover files.

.info sidecar files are basically INI-format files:

[Publication]
title = 1984
authors =  George Orwell
description = Some summary here
language = en
issued = 1949
publisher = SomePublisher, Inc.
identifier = urn:isbn:9781443434973

.cover is just an image file.

Tested devices and applications

The full list of devices and applications is available on the wiki page.

Dependenices

Thanks the following projects used in Lib2OPDS:

Metadata

Release files for lib2opds 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lib2opds 0.5.0
File Size Uploaded
lib2opds-0.5.0.tar.gz 45.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lib2opds 0.5.0
File Interpreter ABI Platform
lib2opds-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 96.2 kB

Release files / lib2opds-0.5.0.tar.gz

Download URL lib2opds-0.5.0.tar.gz
Size 45.2 kB
Tags Source
SHA-256 checksum
How to use checksums
054c2fc973096ee67454515389ac9e45a620365da9244d409f4ddaa223658c14
BLAKE2b-256 checksum
How to use checksums
4aab9f25ccc1f052552b7ef9bd2e0cc84880d22a647e22e5aa4295a9a59bf6b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.

Transparency log

Release files / lib2opds-0.5.0-py3-none-any.whl

Download URL lib2opds-0.5.0-py3-none-any.whl
Size 51.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a17e832b15b4b29d544a34c15bce5548be72d96dcfd5054e208bed41625396a2
BLAKE2b-256 checksum
How to use checksums
e88c1920d1beab2f7abed562ddbb7c52fb6ff8779bfcc5b9713dc0bb6338e901
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page