Skip to main content

Static OPDS catalog generator powered by Python

Project description

Lib2OPDS

lib2opds generates static OPDS (version 1.2) catalog for local e-book library.

Features

  • Directory hierarchy support
  • Virtual directories: new books, authors, languages, decade issued, etc.
  • ePUB format: metadata extraction, thumbnail generation
  • PDF 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

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

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

$ 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.

Example of configuration file for Nginx:

location /library {
        alias /library-dir;
}

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

location /opds/covers {
        alias /opds-dir/covers;
}

Library location here is not protected with basic auth because of the bug in some e-book reader software.

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.4.0.tar.gz (44.5 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.4.0-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lib2opds-0.4.0.tar.gz
Algorithm Hash digest
SHA256 2efa079506ef5c1d2c84a14a387cb67620f0ff97df9f8147e877fe351e1a8b76
MD5 b0be5d4a86ca507381ebe5f1764f2f81
BLAKE2b-256 37a31b22766df7ca59c08af21c0540d10aab41d41b2d8bb4f8aa2342f426316d

See more details on using hashes here.

Provenance

The following attestation bundles were made for lib2opds-0.4.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.4.0-py3-none-any.whl.

File metadata

  • Download URL: lib2opds-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 50.1 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 399489866126a4cd3f0d3c423cf49590c167a8832af50031ed056e8447a43908
MD5 e00de2916fc9879275d785162f7edc69
BLAKE2b-256 213aab74c6a16f122f1d9b837bb2f701d85215aee59536029651636731528ca4

See more details on using hashes here.

Provenance

The following attestation bundles were made for lib2opds-0.4.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