Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 106 additions & 9 deletions docs-developers/server/api/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7261,9 +7261,8 @@ unparseable filter, as for the list.

### `POST /api/v1/admin/books/bulk`

Applies the same field edit to many books in one transaction: **every book is
edited or none is**. Merging two spellings of an author is a bulk `set` of
`author` over their books.
Applies the same field edit to every book in the request, in one
transaction: every book is edited or none is.

Select up to 1,000 books. Each path is at most 4,096 bytes. The edit itself can use up to 1 MiB.
The whole body can use 5,274,112 bytes. An oversized list, edit or request returns 400
Expand Down Expand Up @@ -7336,6 +7335,104 @@ new main series. One book whose old main series can't be listed refuses the whol
request: `400` `code: "invalid_override"` with `field: "series"`, its `error`
ending with that book's path in parentheses.

### `POST /api/v1/admin/books/merge`

Replaces source spellings with a target spelling. In one transaction, the
server selects the matching books and sets the field to the target as an
`edited` override, so every book changes or none does. Audited as
`book.bulk_edit` with `merged`
([Audit log](../backups-and-notifications.md#audit-log)), only when books
changed.

| Body field | Meaning |
|---|---|
| `field` | Required. One of `author`, `narrator` or `series`. |
| `sources` | Required. An array of 1 to 1,000 nonblank spellings. Each must exactly match the whole effective credit or main series name to select a book. For `series`, all sources must have the same series key as the target. |
| `target` | Required. The spelling to keep. The server trims it and requires a nonblank value of at most 500 characters with no control characters. |
| `library_id` | Optional integer. A positive ID selects one book library. Zero or omission selects all book libraries. |

For example, a source of `Weir, Andy` matches that author credit in full. A
longer co-credit containing that name keeps its spelling. Books that already
use the target are excluded.

```json
{
"field": "author",
"sources": ["Weir, Andy", "A. Weir"],
"target": "Andy Weir",
"library_id": 1
}
```

The `200` response contains only the books that changed, or `{"books":[]}`
if none matched. Keep this list for Undo. Each `previous` is the field's prior
override value, or `null` if it had none. A prior override includes its
`source` (`edited` or `community`).

```json
{
"books": [
{ "library_id": 1, "path": "Andy Weir/Artemis", "previous": null },
{ "library_id": 1, "path": "Andy Weir/The Martian", "previous": "A. Weir", "source": "community" }
]
}
```

| Status | When it applies |
|---|---|
| `400` | `too_large` if more than 5,000 books would change, more than 1,000 sources are supplied or the body exceeds 1 MiB. The server writes nothing. |
| `400` | Malformed JSON or an unknown key returns `invalid request`. A validation failure returns `invalid_override` with `field`: `field` for an unknown field name, `library_id` for a negative ID, `sources` for an empty list, a blank source or unrelated series names, `target` for a blank target, and the merged field's own name (`author`, `narrator` or `series`) for a target that is too long or holds control characters. |
| `401` / `403` | anonymous / non-admin |
| `404` | The supplied library ID is unknown. The response is `{"error":"library not found"}`. |
| `409` | `not_book_library` if the ID belongs to a podcast library. |

### `POST /api/v1/admin/books/merge/undo`

Send the original `field` and `target` with the `books` array
from the merge response. Each book's `library_id` and `path` set the scope.
The server counts a repeated path in the same library once.

```json
{
"field": "author",
"target": "Andy Weir",
"books": [
{ "library_id": 1, "path": "Andy Weir/Artemis", "previous": null },
{ "library_id": 1, "path": "Andy Weir/The Martian", "previous": "A. Weir", "source": "community" }
]
}
```

If the current override still equals the target, Undo restores the prior
value with its original source. For `previous: null`, it removes the override
so the field follows its underlying metadata again. Undo restores eligible
books in one transaction, so a write failure restores none. Audited as
`book.bulk_edit` with `revert`, only when it restored books.

The `200` response counts restored books and lists every skip by library,
path and reason. The list is empty when all books were restored.

```json
{
"restored": 1,
"skipped": [
{ "library_id": 1, "path": "Andy Weir/Artemis", "reason": "changed" }
]
}
```

- `changed` means the field's override now differs from the target or someone
has removed it. Undo preserves the current value.
- `not_found` means no book is indexed at that library and path, for example
after a scan found that the book had moved. Other eligible books still go back.

Undo returns `400` with `too_large` for more than 5,000 entries in `books`
or a body over 36,185,536 bytes. Malformed JSON or an unknown key returns `400` with
`invalid request`. An empty list or invalid field, target or prior override
returns `400` with `invalid_override`, and the `401` / `403` rule is the
merge's. An unknown or podcast library is not an error here: its books are
skipped as `not_found`.

### `GET /api/v1/admin/authors` · `GET /api/v1/admin/narrators`

The distinct authors (or narrators) with their book counts and total duration,
Expand Down Expand Up @@ -7379,9 +7476,8 @@ The narrators route uses the key `narrators` instead of `authors`.
kept, so names in non-Latin scripts get suggestions too and two different
ones never group by accident. `suggested` is the spelling
with the most books (ties: the `Given Surname` form over `Surname, Given`, then
alphabetical); `books` is the group's total. The
server never merges on its own; applying a suggestion is a
[bulk edit](#post-apiv1adminbooksbulk).
alphabetical). To apply a suggestion, send the other `names` as `sources`
and `suggested` as the `target` to the [merge endpoint](#post-apiv1adminbooksmerge).

### `GET /api/v1/admin/series`

Expand Down Expand Up @@ -9060,9 +9156,10 @@ library, from the same rule as the `series_spellings` count.
- A series can be in both views while some of its books are ignored and some not.
At most 200 entries, ordered by `suggested` (case-insensitive), then library.

The console's fix is a [bulk edit](#post-apiv1adminbooksbulk) setting `series` on
the books of the other spellings, as an author merge is; ignoring a series is a
`series_spellings` ignore of every one of its books.
The console sends the group's `library_id`, the chosen target and the other
spellings to the [merge endpoint](#post-apiv1adminbooksmerge) with `field`
set to `series`. Ignoring a series applies a `series_spellings` ignore to
every one of its books.

### `POST /api/v1/admin/issues/ignore` · `DELETE /api/v1/admin/issues/ignore`

Expand Down
7 changes: 7 additions & 0 deletions docs-developers/server/backups-and-notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@ Notes on the longer rows:
is the member's username. `DELETE /me/devices/{id}?also_members=1` also
records one `device_revoke` per member it signs out, with the owner's device
id.
- **`book.bulk_edit`.** A bulk edit records the edit as sent (`set`,
`revert`, `add`, `remove` and so on) and the count in `books`. A spelling merge that changes books adds
one too: the target in `set`, the changed count in `books` and the first 20
source spellings in `merged` (**Merged spellings**), each limited to 120
characters. A merge scoped to one library
also records its name in `library`. An Undo that restores books adds one
entry with the field in `revert` and the restored count in `books`.
- **`settings.support`.** An answer to the console's
[support card](web-ui.md#the-support-card). Details: `choice` (`donated` or
`snoozed`) and, for a snooze, `returns_at`. It is not recorded when a donation
Expand Down
2 changes: 1 addition & 1 deletion docs-developers/server/scanner.md
Original file line number Diff line number Diff line change
Expand Up @@ -2111,7 +2111,7 @@ predicate over `books b`, shared by the counts (`IssueCounts`) and the lists
| `no_cover` | a scan has checked it (`has_cover` not `NULL`), and it has no sidecar image, no embedded art and no custom cover |
| `unmatched` | it has no ASIN, no ISBN and no recorded community match (`book_matches`, see [Data model](data-model.md#durable-per-library-config-path-keyed-no-fk-to-books); `NOT catalog.matchedExpr`). [Tag hints](data-model.md#tag-hints) and an import's [match hints](data-model.md#match-hints-from-an-import) don't count. Offered only while community metadata is on |
| `unknown_asin` | its own ASIN is one the [unknown-ASIN report](configuration.md#the-unknown-asin-report-metadatareport_unknown) found the community database doesn't know (an `unknown_asin_reports` row with `unknown = 1`, matched on the upper-cased, trimmed ASIN; `unknownASINExpr`), and it has no ISBN, no `book_matches` row and no ASIN a community match gave it (`book_overrides` of source `community`), so matching it by hand settles it. It still counts as matched (`matchedExpr`), so Match automatically skips it; from 2.7.0 the kind's own card starts an [`unknown_asin` match run](api/reference.md#post-apiv1adminmatch-runs) for it, which finds each book by its title. The summary lists the kind only while the report is on, since only its lookups fill the table |
| `series_spellings` | another book of its library spells its main series another way: the same `series_key`, a different `series`. This takes two range seeks on `idx_books_series_key`, for a spelling below its own or above. `SeriesSpellingGroups` lists them per series from the same predicate, and the console's fix sets one spelling with a bulk edit |
| `series_spellings` | Another book in the library has the same main `series_key` with a different `series` spelling. Two range seeks on `idx_books_series_key` look for a spelling below or above the book's own. `SeriesSpellingGroups` uses the same rule to group books by series. The console applies the chosen spelling with the [merge endpoint](api/reference.md#post-apiv1adminbooksmerge). |
| `no_chapters` | it is longer than **2 hours** and has at most one chapter. The console shows why community chapters weren't used from the row's `chapters_check` (a failed [community chapter check](community-chapters.md)) |
| `detailed_chapters` | its last community chapter check is `refine` (the community's finer chapters fit), it has no `chapter_source` choice and no edited chapter list. Picking either source, or editing the chapters, settles it |
| `transcode` | its codec doesn't play in browsers (`media.DirectPlayable`) |
Expand Down
15 changes: 10 additions & 5 deletions docs-developers/server/web-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,13 @@ The Overview is built on `GET /admin/stats`, `GET /admin/sessions/live`,
#### Library > Authors, Narrators and Series

These screens run on `GET /admin/authors`, `/admin/narrators` and
`/admin/series`. Narrators' merge suggestions are applied as a bulk edit, with
Undo.
`/admin/series`. For an author or narrator suggestion, `useMerge` sends one
[`POST /admin/books/merge`](api/reference.md#post-apiv1adminbooksmerge) with
the spellings and the selected library, if any. The confirmation's **Undo**
sends the returned books with the original field and target in one
[`POST /admin/books/merge/undo`](api/reference.md#post-apiv1adminbooksmergeundo).
If Undo skips books, the console shows up to three paths and counts the rest.
If the Undo request fails, the console offers **Undo** again.

**Series gaps.** A series card shows community series gaps, hidden when
metadata is off:
Expand Down Expand Up @@ -1169,9 +1174,9 @@ Series spelled several ways (`series-spellings.tsx`) are grouped too, with one
notice per series and library from `GET /admin/issues/series-spellings`:

- The suggested spelling is picked first in a select.
- "Use this spelling" runs the Authors page's merge (`useMerge` on `series`).
That is a bulk `series` edit of the books whose main series is that series,
with Undo.
- **Use this spelling** calls `useMerge` with `series` and the group's library
ID: the same merge and **Undo** as
[Library > Authors](#library--authors-narrators-and-series).
- Ignore and Show again cover every one of the series' books.

##### Match automatically
Expand Down
21 changes: 17 additions & 4 deletions docs-users/admin/books.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,20 @@ book credited to two people counts for each of them.

When two names look alike, a suggestion appears above the list, for example
"“Sanderson, Brandon” looks like Brandon Sanderson". Click **Merge authors** (or
**Merge narrators**) to set one spelling on every book, as an edit. The
confirmation has an **Undo** button.
**Merge narrators**) to use the suggested spelling, as an edit. The merge covers
the selected library, or all book libraries if you haven't picked one. For two
names AudioSilo doesn't suggest, use a [bulk edit](#changing-many-books-at-once).

Only a whole credit changes. For example, merging “Sanderson, Brandon” into
“Brandon Sanderson” leaves “Sanderson, Brandon & Janci Patterson” as written.
AudioSilo changes every matching book together or none of them, and none if
more than 5,000 books would change.

Choose **Undo** in the confirmation to put back each book's earlier name, your
earlier edit or the community value. A name that came from the book's files or
folder follows them again. Undo skips a book whose name someone has changed or
reverted since, or that a scan found had moved, and restores the others. The
message lists up to three skipped paths and counts any others.

## Series

Expand All @@ -399,9 +411,10 @@ author** to narrow the list.
![Library > Series](/img/screenshots/admin/series.png)

Spellings that differ only in capitals, accents, punctuation or spaces count as
one series. Other differences ("The Expanse" and "Expanse") make two series.
Fix those with a [bulk edit](#changing-many-books-at-once), or use
one series. To use one spelling throughout a library, open
[Series spelled several ways](health.md#series-spelled-several-ways) in Health.
Names such as "The Expanse" and "Expanse" count as two series. To give their
books the same series name, use a [bulk edit](#changing-many-books-at-once).

With community metadata on, a series with a matched book also shows the books
you don't have, as dashed gaps: "You have 1, 2, 4 of 5; missing 3, 5". A gap
Expand Down
17 changes: 9 additions & 8 deletions docs-users/admin/health.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ delete its files from the library folder and rescan.

### Series spelled several ways

AudioSilo already shows spellings that differ only in capitals, accents or
punctuation as one series. But the books still say it differently in the
players' details. This list fixes that.

- **Use this spelling** sets one spelling on every book of the series, as an
edit. Pick another spelling from the list beside it if you prefer. The
message has an **Undo** button.
- **Ignore** stops suggesting that series.
Pick the series spelling you want listeners to see, then click **Use this
spelling**. AudioSilo offers this choice when books in one library spell their
main series differently in capitals, accents, punctuation or spacing.
**Ignore** hides the suggestion for that series.

AudioSilo changes every matching main series name in that library and keeps
each book's position in the series. Books that list the series only as an
additional series keep their spelling. The limit, all-or-nothing rule and **Undo** work as for
[merging two spellings](books.md#merging-two-spellings) of an author.

### When a library is offline

Expand Down
6 changes: 6 additions & 0 deletions docs-users/admin/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,5 +379,11 @@ books, settings, backups and notifications. An Audible backup action names the
account it was for. Sign-ins and listening are in
[Activity](activity.md), and scans in [Health > Jobs](health.md#jobs).

A spelling merge shows as **Edited several books**, with the spelling you
chose, how many books changed and the library, when the merge covered one
library. **Merged spellings** lists up to 20 of the old spellings. An **Undo**
that restores books adds a second entry, with the field it put back (for example
"author") under **Reverted** and how many books.

The log never holds a password or other secret, and no IP addresses. Entries
are kept for a year.
4 changes: 3 additions & 1 deletion scripts/server-names.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"repo": "KodeStar/audiosilo-server",
"ref": "d91029684a73476096a7c8691effbdfd57db28c8",
"ref": "84556ddb12d396cff33a154dde8201e003099516",
"capabilities": [
"addresses",
"admin_ui",
Expand Down Expand Up @@ -74,6 +74,8 @@
"/api/v1/admin/books",
"/api/v1/admin/books/bulk",
"/api/v1/admin/books/facets",
"/api/v1/admin/books/merge",
"/api/v1/admin/books/merge/undo",
"/api/v1/admin/books/works",
"/api/v1/admin/bridge",
"/api/v1/admin/bridge/estimate",
Expand Down