Lib2opds
lib2opds is static OPDS catalog generator for your ebook library
Install / Use
/learn @oxdef/Lib2opdsREADME
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.
lib2opdsre-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:
Related Skills
node-connect
353.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
353.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
353.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
