feat(metadata): add Deutsche Nationalbibliothek (DNB) metadata provider (#1547)

## feat(metadata): add Deutsche Nationalbibliothek (DNB) metadata
provider

This adds the Deutsche Nationalbibliothek (DNB) as a metadata provider.
It covers German editions far better than the existing providers.
No API key, disabled by default, and the same pattern as the other
providers.

It uses DNB's public SRU interface and parses MARC21-XML. Thats one
reason why this needs more code than the Google Books or Open Library
providers. The others are the search (DNB has no relevance ranking) and
the language filter, see below.

### Notes
- **Search box.** Search-box text goes from precise to loose until a
stage has hits: the complete title, then the title as a phrase, then
every word in a title or a person's name, last without German articles.
- **"Only show editions in my book languages"** (optional, on by
default). DNB also catalogs a lot of translations. DNB filters by the
searching user's Default Book Languages, else the system default.
- **No covers.** DNB's cover service is behind Anubis bot protection, so
the provider returns no cover URLs.
- **Proxy support** already included like Open Library since #1526


### Changes outside the provider
- DNB is in the onboarding dropdown.
- Calibre's `dnb-idn` identifier is mapped, so DNB results show library
ownership
- In the env-var docs I added only the DNB section. Regenerating the
whole file on main currently also reorders unrelated sections and drops
`SHELFMARK_API_KEY_READONLY` (and the Databáze knih section sits inside
the Moly.hu block).

### Ideas
- **Deduplication.** DNB lists every edition. Kafka's "Die Verwandlung"
has around 200 German editions of the same text. Grouping them would
touch the API, the frontend and release search.
- **Language-aware metadata search** for all providers. The other
providers ignore Default Book Languages in metadata search. The
`user_id` added here could serve them too.
This commit is contained in:
ProcyonX1 authored and GitHub committed 2026-10-22 20:37:15 -04:00
1 parent 2007384058
commit 99a6aa206b
12 files changed
+1915 -2

No files matched your search

+42
View File
@@ -28,6 +28,7 @@ This document lists all configuration options that can be set via environment va
- [Google Books](#metadata-providers-google-books)
- [Moly.hu](#metadata-providers-moly.hu)
- [Databáze knih](#metadata-providers-databáze-knih)
- [DNB](#metadata-providers-dnb)
- [Direct Download](#direct-download)
- [Download Sources](#direct-download-download-sources)
- [Cloudflare Bypass](#direct-download-cloudflare-bypass)
@@ -2742,6 +2743,47 @@ Enable Moly.hu as a metadata provider for book searches
</details>
### Metadata Providers: DNB
| Variable | Description | Type | Default |
|----------|-------------|------|---------|
| `DNB_ENABLED` | Enable DNB as a metadata provider for book searches | boolean | `false` |
| `DNB_DEFAULT_SORT` | Default sort order for DNB search results. | string (choice) | `relevance` |
| `DNB_USE_BOOK_LANGUAGES` | Filter DNB results by Default Book Languages: each user's own setting, else the system default. DNB also catalogs translations into many other languages. | boolean | `true` |
<details>
<summary>Detailed descriptions</summary>
#### `DNB_ENABLED`
**Enable DNB**
Enable DNB as a metadata provider for book searches
- **Type:** boolean
- **Default:** `false`
#### `DNB_DEFAULT_SORT`
**Default Sort Order**
Default sort order for DNB search results.
- **Type:** string (choice)
- **Default:** `relevance`
- **Options:** `relevance` (Most relevant), `newest` (Newest), `oldest` (Oldest)
#### `DNB_USE_BOOK_LANGUAGES`
**Only show editions in my book languages**
Filter DNB results by Default Book Languages: each user's own setting, else the system default. DNB also catalogs translations into many other languages.
- **Type:** boolean
- **Default:** `true`
</details>
## Direct Download
### Direct Download: Download Sources