Skip to main content

Static OPDS catalog generator powered by Python

Project description

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:

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

lib2opds-0.5.0.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

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

lib2opds-0.5.0-py3-none-any.whl (51.0 kB view details)

Uploaded Python 3

File details

Details for the file lib2opds-0.5.0.tar.gz.

File metadata

  • Download URL: lib2opds-0.5.0.tar.gz
  • Upload date:
  • Size: 45.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lib2opds-0.5.0.tar.gz
Algorithm Hash digest
SHA256 054c2fc973096ee67454515389ac9e45a620365da9244d409f4ddaa223658c14
MD5 ba996f239a5c07c217bd8531f439dd4d
BLAKE2b-256 4aab9f25ccc1f052552b7ef9bd2e0cc84880d22a647e22e5aa4295a9a59bf6b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for lib2opds-0.5.0.tar.gz:

Publisher: publish-to-pypi.yml on oxdef/lib2opds

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lib2opds-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: lib2opds-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 51.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lib2opds-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a17e832b15b4b29d544a34c15bce5548be72d96dcfd5054e208bed41625396a2
MD5 59e437003c6f0730e2ba5c943ef59620
BLAKE2b-256 e88c1920d1beab2f7abed562ddbb7c52fb6ff8779bfcc5b9713dc0bb6338e901

See more details on using hashes here.

Provenance

The following attestation bundles were made for lib2opds-0.5.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on oxdef/lib2opds

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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