diff --git a/docs-developers/server/api/reference.md b/docs-developers/server/api/reference.md index 9c6ea4e5..b2c975a4 100644 --- a/docs-developers/server/api/reference.md +++ b/docs-developers/server/api/reference.md @@ -1157,8 +1157,8 @@ callers only and omitted otherwise, so the player's listing is unchanged. **Order.** Directories come first, then files, each group in **natural order** (`naturalLess`, the order a folder book's files play in, so `2` lists before `10`; see [Book detection](../scanner.md#book-detection-booksindir)). A -joined book's discs play in `discOrder`, which also ignores spaces, hyphens and -underscores, so only a disc set named unevenly (`CD1` beside `CD 2`) lists in +joined book's discs play in `metadata.DiscOrder`, which also ignores spaces, +hyphens and underscores, so only a disc set named unevenly (`CD1` beside `CD 2`) lists in another order than it plays. An older server sorts each group by its lowercased name, character by character (`10` before `2`). @@ -7067,7 +7067,7 @@ With `issue=no_chapters`, eligible book rows can carry `detect_job` so Health ca | `min_duration` · `max_duration` | number (seconds) | - | inclusive bounds; `0` means no bound | | `added_after` | date | - | inclusive lower bound on `added_at`: `YYYY-MM-DD` (used as is) or an RFC 3339 time (any offset; converted to UTC before comparing) | | `added_before` | date | - | exclusive upper bound, same formats | -| `issue` | string | - | one [Health issue](#get-apiv1adminissues) kind's books: `scan_error`, `suspect`, `split_discs` (one row per split book: its first disc), `no_cover`, `unmatched`, `unknown_asin`, `series_spellings`, `no_chapters`, `detailed_chapters` or `transcode` (not `duplicate`, which comes as groups from [`/admin/issues/duplicates`](#get-apiv1adminissuesduplicates)). Books an admin ignored for that kind are left out. Any other value is `400 unknown issue` | +| `issue` | string | - | one [Health issue](#get-apiv1adminissues) kind's books: `scan_error`, `suspect`, `split_discs` (one row per split book: its first disc), `no_cover`, `unmatched`, `unknown_asin`, `series_spellings`, `no_chapters`, `detailed_chapters` or `transcode` (not `duplicate`, which comes as groups from [`/admin/issues/duplicates`](#get-apiv1adminissuesduplicates)). Books an admin ignored for that kind are left out. An ignored `split_discs` set leaves out its first disc, whichever disc that is. Any other value is `400 unknown issue` | | `issue_ignored` | `true`\|`false` | - | with `issue`, list **only** the books an admin ignored for it; without `issue` it is `400 issue_ignored needs an issue` | | `sort` | string | `title` | `title` \| `author` \| `surname` \| `series` \| `narrator` \| `published` \| `added` \| `duration` \| `size` | | `order` | string | `asc` | `asc` \| `desc` | @@ -8905,10 +8905,11 @@ a scan last finished. whose chapters no admin has edited (an edit settles it, applied or dormant). The console's fix is a bulk edit with `chapter_source: "community"`. - `split_discs` is a book split across disc folders (a CD rip read as one book - per disc), counted once and listed by its first disc. The console's fix sets a - `book` [folder override](#put-apiv1adminlibrariesidfolder-override) on the - folder holding the discs, which joins them. Its discs are never also grouped - as `duplicate`. + per disc), counted once and listed by its first disc in `metadata.DiscOrder` + (CD2 before CD10). Ignoring that disc hides the whole set. The + console joins the discs by setting a `book` + [folder override](#put-apiv1adminlibrariesidfolder-override) on their + parent folder. Split discs are excluded from `duplicate`. - `unmatched` is **left out while community metadata is off**, since there is nothing to match against. - `unknown_asin` is a book whose own ASIN the community database doesn't know, @@ -8936,21 +8937,28 @@ a scan last finished. ### `GET /api/v1/admin/issues/duplicates` -Groups of books that look like the same book **within one library** (copies in -different libraries are usually deliberate and are grouped only with `across`). +Returns **comparisons**: duplicate groups within each library and, with +`across=1`, two-book pairs from different libraries. The Health summary counts +only the groups within a library. | Query param | Type | Notes | |---|---|---| -| `library_id` | int | one library; a non-positive or non-integer id is `400 invalid library_id` | -| `ignored` | `true` | return **only** the groups an admin said are different books (instead of the open ones) | -| `across` | `1` or `true` | also group copies in **different** libraries (2.4.0, the console's "Include other libraries"): each copy's row names its `library_id` and `library_name`, and with `library_id` the groups holding one of that library's books are kept, their copies from any library. Without it nothing changes; the Health `duplicate` count never uses it | -| `limit` | int | from 2.5.1: groups per page, at most 500 (a larger value is 500; one that is not a positive integer counts as absent). A page can end early (below), so page on `next_cursor`, not on the count | +| `library_id` | int | Return groups and pairs involving this library. A non-positive or non-integer ID returns `400 invalid library_id`. | +| `ignored` | `true` | Return only ignored comparisons. The default returns only open comparisons. | +| `across` | `1` or `true` | Include cross-library pairs. Each copy's row names its `library_id` and `library_name`. | +| `limit` | int | from 2.5.1: comparisons per page, at most 500 (a larger value is 500; one that is not a positive integer counts as absent). A page can end early (below), so page on `next_cursor`, not on the count | | `cursor` | string | from 2.5.1: the previous page's `next_cursor`, passed back verbatim; a malformed one is `400 invalid cursor` | +Within a library, matches can connect through a third book. A cross-library +pair needs its two books to match each other directly, and appears once even +if it matches in several ways. [Duplicates](../scanner.md#duplicates) lists +the signals and the limit on a signal many books share. + ```json { "groups": [ { + "key": "3a12d203c553ce7e7b6580782057b1f63a0103442992ff3609c77991b41df021", "reason": "same_files", "ignored": false, "books": [ @@ -8961,10 +8969,13 @@ different libraries are usually deliberate and are grouped only with `across`). } ], "total": 132, - "next_cursor": "THV3aXMgQ2Fycm9sbC9BbGljZSdzIEFkdmVudHVyZXMgaW4gV29uZGVybGFuZAAx" + "next_cursor": "TGV3aXMgQ2Fycm9sbC9BbGljZSdzIEFkdmVudHVyZXMgaW4gV29uZGVybGFuZAAzYTEyZDIwM2M1NTNjZTdlN2I2NTgwNzgyMDU3YjFmNjNhMDEwMzQ0Mjk5MmZmMzYwOWM3Nzk5MWI0MWRmMDIxADE" } ``` +- `key` identifies this exact comparison. It is the 64-character hex SHA-256 + digest of the sorted library and path references. Changing the order of the + displayed copies preserves the key. Adding or removing a member changes it. - `reason` - why the books were grouped, from the joins that formed the group. "Lengths match" means within a minute or 2%. For `same_book` an unknown length (no ffprobe) matches only another unknown one; for a shared ASIN or ISBN an @@ -8987,20 +8998,17 @@ different libraries are usually deliberate and are grouped only with `across`). (better format, then a single file, then the higher bitrate, then more listeners). Under `id_length_differs` the order says nothing about which to keep. -- `ignored` - every copy in the group is ignored for `duplicate`. Without - `?ignored=true` only groups with `ignored: false` are returned; with it, only - the ignored ones. An ignored group becomes open again by itself when a new - copy joins it. -- Groups are ordered by library and the kept copy's path, and paged by keyset - on that order (from 2.5.1): `cursor` names the last group's kept copy, so a - group that comes or goes between pages moves no other group across the - boundary. The groups are found afresh for every page. A group whose kept copy - changes between two page loads (a better copy arrived) can sort elsewhere, so - a client paging through should show a group once even if a later page brings - it again. -- `total` - how many groups there are in all, on every page (counted after the - `ignored` filter, so every ignored group can be reached). `next_cursor` is - omitted on the last page. +- `ignored` says whether the comparison is dismissed. A dismissal applies to + one pair or one group's exact membership. Other comparisons can include the + same book. A group that gains or loses a copy needs its own decision. +- Pages sort by the first copy's library ID, its path, then the comparison + `key`. The cursor includes all three, so comparisons sharing the same first + copy can fall on successive pages. If the kept copy changes between requests, a + comparison can appear on two pages. Clients should deduplicate by `key`. +- `total` counts every comparison the request selects, cross-library pairs + included, and is the same on every page. The server counts after the + `ignored` filter, so every ignored comparison can be reached. `next_cursor` + is omitted on the last page. - With `limit`, a page also stops before a group that would take it past **300 copies**, unless the page is still empty. Each copy is a full admin row, so without this a few very large groups (identical audio across a big library) @@ -9058,9 +9066,8 @@ the books of the other spellings, as an author merge is; ignoring a series is a ### `POST /api/v1/admin/issues/ignore` · `DELETE /api/v1/admin/issues/ignore` -`POST` stops listing books under one issue kind; `DELETE` lists them again (the -console's Undo and "Show again"). For duplicates, ignore every copy of a group -("They're different books"). +`POST` hides a selection under one issue kind. `DELETE` shows it again. Both +operations are idempotent and return `204 No Content` on success. Each request takes up to 1,000 selections with paths of at most 4,096 bytes. An oversized body (over 4,225,536 bytes) or list returns 400 `too_large`. A single overlong path returns 400 @@ -9070,16 +9077,40 @@ Each request takes up to 1,000 selections with paths of at most 4,096 bytes. An { "kind": "no_cover", "books": [ { "library_id": 1, "path": "Sun Tzu/The Art of War" } ] } ``` -- `kind` - one of the ten kinds above. -- `books` - 1 to 1000 `{library_id, path}` refs. The books needn't be indexed: - the rows are path-keyed durable state (`issue_ignores`), so an ignore - survives rescans and rebuilds and moves with the book. A ref in a library - that doesn't exist is skipped. -- Idempotent both ways. Response `204 No Content`. +- `kind` names one of the [Health issue kinds](#get-apiv1adminissues). +- `books` contains library IDs and library-relative paths. For a per-book + issue, send each book to hide or restore. The book can be absent from the + index. The server skips references to missing libraries. For `split_discs`, + send the displayed disc. The decision covers the folder containing the discs, + including when a different disc comes first. +- For `duplicate`, send the distinct references from **one comparison** in a + single request. Send every member of a group within one library, or both + members of a pair from different libraries. Send the same selection to + restore it. +- `group_key` selects a whole in-library group of any size in one request: + send one member in `books` and the group's returned `key` in `group_key`. A + group of more than 1,000 copies needs this form. The key still resolves a + saved decision after a rescan changes the group. If the key matches neither + a stored decision nor a current group in that library, `POST` returns + `400 duplicate group has changed` and `DELETE` returns `204` without + changing anything. A cross-library pair's key never matches, so send a + pair's two members in `books` instead. + +The following body selects the entire Alice comparison shown above by key. + +```json +{ + "kind": "duplicate", + "books": [{ "library_id": 1, "path": "Inbox/Alice (copy)" }], + "group_key": "3a12d203c553ce7e7b6580782057b1f63a0103442992ff3609c77991b41df021" +} +``` | Status | Meaning | |---|---| -| `400` | `invalid request`; `books is required`; `every book needs a library_id and a path`; `unknown issue`; `code: "too_large"` for more than 1000 books | +| `400` | `invalid request`, `books is required`, `every book needs a library_id and a path`, `unknown issue`, or `too_large` for an oversized selection or body | +| `400` | `select a duplicate group in one library or a pair in different libraries` for an invalid duplicate selection, including a reference outside the group identified by the key | +| `400` | `group_key needs one member of a duplicate group` if a nonempty `group_key` has the wrong length, the kind is different, or the selection has multiple members | ### `POST /api/v1/admin/libraries/{id}/book/rescan` diff --git a/docs-developers/server/data-model.md b/docs-developers/server/data-model.md index 8b212b3e..4025051a 100644 --- a/docs-developers/server/data-model.md +++ b/docs-developers/server/data-model.md @@ -24,8 +24,10 @@ to understand before you change the schema. `listening_sessions`, `listening_daily`, `favourites`, `up_next`, `collection_items` and `ratings`; - per-library config: `folder_overrides`, `book_enrichment`, - `issue_ignores`, `book_overrides`, `chapter_overrides`, `chapter_choices`, - `chapter_edits`, `book_covers`, `book_matches` and `book_hints`. + `issue_ignores`, `duplicate_decisions`, `book_overrides`, `chapter_overrides`, + `chapter_choices`, `chapter_edits`, `book_covers`, `book_matches` and `book_hints` + (`duplicate_decisions` keys a comparison by its library IDs and member + paths, see [Health ignores](#health-ignores)). The rest of a listener's own state hangs off the account rather than a path: `collections`, `collection_shares`, `listening_goals` and @@ -70,8 +72,9 @@ Move-tracking covers the remaining gap, a file that *moves* on disk. The scanner fingerprints files (`books.content_hash`) and calls `catalog.MoveDurableState` to carry every path-keyed book table from the old path to the new one (see [Scanner](scanner.md#move-detection)). That is -every table above except `folder_overrides`, which is keyed by folder, not -book. When an admin joins a folder's disc folders into one book, +every table above except the rows keyed by a folder rather than a book: +`folder_overrides` and a split disc set's `issue_ignores` row. When an admin +joins a folder's disc folders into one book, `catalog.JoinDurableState` hands the disc books' state to the joined book the same way (see [Joined books](scanner.md#joined-books-disc-sets)). @@ -112,6 +115,7 @@ erDiagram libraries ||--o{ book_matches : "durable config" libraries ||--o{ book_hints : "durable config" libraries ||--o{ issue_ignores : "durable config" + libraries ||--o{ duplicate_decisions : "libraries in a comparison" libraries ||--o{ scan_runs : "scan history" libraries ||--o{ community_chapters : "path-keyed, NO FK to books" libraries ||--o{ chapter_choices : "path-keyed, NO FK to books" @@ -534,8 +538,9 @@ The console's Health page reads these: duplicate groups (which leave such discs out) and the admin's `split_discs` mark on `GET /fs`. The partial index `idx_books_split_parent` on `(library_id, split_parent, rel_path)` (`WHERE split_parent <> ''`) finds a - folder's discs in order. An unchanged book whose value is out of date gets - it without a re-index (see [Joined books](scanner.md#joined-books-disc-sets)). + folder's discs. Health picks the first with `metadata.DiscOrder`. The scanner + updates `split_parent` on an unchanged book without re-indexing it (see + [Joined books](scanner.md#joined-books-disc-sets)). Every re-index rewrites them, like the rest of the row. @@ -2052,19 +2057,57 @@ keeps the report to once a day across restarts. The run status is the `import_id`, `set_at`. Identifiers another app gave a book, kept as hints for a community match only. See [Match hints from an import](#match-hints-from-an-import). -- **`issue_ignores`** *(0017)*: PK `(library_id, path, kind)`, `created_by` - (FK to `users`, `ON DELETE SET NULL`), `created_at`. An admin's "ignore this" - on a Health issue. `kind` is one of `catalog.IssueKinds` (`scan_error`, - `suspect`, `split_discs`, `duplicate`, `no_cover`, `unmatched`, - `unknown_asin`, `series_spellings`, `no_chapters`, `detailed_chapters`, - `transcode`). It is path-keyed like the - rest of this group, so an ignore survives a rebuild, moves with the book - (`MoveDurableState`) and needn't point at an indexed book. - -All of these FK to `libraries` with `ON DELETE CASCADE` only. Deleting a -library removes its config, and nothing else does. Pruning a vanished book -keeps its edits and cover for the day the path comes back, although a custom -cover is only served while a book is indexed at its path. +- **`issue_ignores`** and **`duplicate_decisions`** store an admin's + [Health ignores](#health-ignores). + +Deleting a library removes its config through `ON DELETE CASCADE`. Pruning +a vanished book keeps its edits and cover for the day the path comes back, +although a custom cover is only served while a book is indexed at its path. + +#### Health ignores + +Health identifies each book by its library ID and library-relative path. +Neither table stores `books.id`, so decisions survive index rebuilds. Both record +`created_at` and `created_by`. Deleting the admin sets `created_by` to `NULL`. + +- **`issue_ignores`** (0017) has primary key `(library_id, path, kind)`. For + per-book issues, `path` follows the book on a detected move. For a split + disc set, the stored kind is `split_disc_set` and `path` names the folder + holding the discs (`books.split_parent`). When the scanner detects a folder + rename, `MoveFolderFavourites` moves that ignore to the new folder path. A + duplicate dismissal never writes this table. Its `duplicate` and + `duplicate_mapped` rows are flags from before 0092 (below). +- **`duplicate_decisions`** (0092) has primary key + `(library_id, other_library_id, paths)`. Within one library the two IDs + are equal and `paths` is a JSON array of all member paths sorted by path + bytes. For a cross-library pair, the array contains one path per library in + ascending library ID order. A dismissal sets `ignored` to 1. + `MoveDurableState` rewrites a moved book's path in every comparison that + names it. Both library IDs reference `libraries` with `ON DELETE CASCADE`. + +Migration `0092_health_ignores` maps old split-disc ignores to their parent +using the index or a recognizable disc folder name. If it cannot identify +the parent, it keeps the old `split_discs` row. Health still checks every +indexed disc of the set for those rows. + +For duplicates, the migration recovers selections that share an admin and +timestamp. Before the first scan, `MapLegacyDuplicateIgnores` checks the +pre-upgrade index for groups hidden under the old all-members rule. For a +cross-library pair, it checks whether the whole former group was hidden. +It changes each confirmed member's `issue_ignores` kind from `duplicate` to +`duplicate_mapped`, and deletes the `map_duplicate_ignores_0092` +`server_state` key that the migration set, in the same transaction. + +While any member still has a `duplicate` row, a comparison with no exact +decision stays hidden only if every member has a `duplicate` or +`duplicate_mapped` row. Restoring a +comparison with old flags records an explicit `ignored = 0`. That keeps the +fallback from hiding a later group containing the restored comparison. + +To downgrade to v2.6.x, restore the pre-upgrade database backup. That +version reads only the old per-book flags. On the upgraded database it would +show as open the mapped duplicate groups, the migrated split-disc sets, and +every comparison or disc set ignored after the upgrade. #### `book_matches` @@ -2529,6 +2572,7 @@ The migration history so far: | 0089 | `notify_outbox` | Records pending notification deliveries and attempts for each event and destination. | | 0090 | `chapter_basis_match` | Includes the recorded work and recording in the basis for a community chapter check. | | 0091 | `mp3_rev2_tag_read_failed` | Advances current revision 1 rows for books without an MP3 to revision 2. The next scan [re-indexes MP3 books once](scanner.md#the-first-scan-after-updating). Adds the nullable `books.tag_read_failed_at` timestamp. | +| 0092 | `health_ignores` | Stores duplicate decisions per comparison and split-disc ignores per folder. Carries forward [existing Health ignores](#health-ignores). | `server_state.progress_feed` identifies the Audible progress feed. A restore renews this ID before clients can page it. The separate data-folder mark detects a database restored behind the last diff --git a/docs-developers/server/scanner.md b/docs-developers/server/scanner.md index 0e1f618f..8b8b15a3 100644 --- a/docs-developers/server/scanner.md +++ b/docs-developers/server/scanner.md @@ -833,8 +833,9 @@ or the one holding it, with `book` and a disc set. - **The joined book** (`joinedBook`) is a folder book at the folder's path, with the discs' audio as its files. Hidden files and the ignore rules apply as usual. - - The disc folders come in natural order (`discOrder`): `CD2` before `CD10`, - `CD 1` equal to `CD1`, ties by path. + - `metadata.DiscOrder` sorts disc folder names in natural order, so `CD2` + precedes `CD10`. If names compare equally, as `CD 1` and `CD1` do, the + exact path bytes break the tie. - Each disc's files keep exactly the order a book of that disc alone has (natural name order, `sortFileOrder`, above), since the state carry-over maps a disc position as offset plus position. @@ -2106,7 +2107,7 @@ predicate over `books b`, shared by the counts (`IssueCounts`) and the lists |---|---| | `scan_error` | `scan_error` is set | | `suspect` | `suspect_parts >= 2`, and the folder has no `book` override | -| `split_discs` | it is the **first** disc (by `rel_path`) of a book split across disc folders. `split_parent` is set, and that folder has no override of either mode (either one settles how it reads). Its fix sets `book` on `split_parent`, which joins the discs | +| `split_discs` | It is the first disc in `metadata.DiscOrder` (`disc_before` in SQL). The discs share a `split_parent` with no folder override. Setting `book` on that folder joins the discs. | | `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 | @@ -2118,11 +2119,8 @@ predicate over `books b`, shared by the counts (`IssueCounts`) and the lists #### Duplicates -Duplicates are groups, found in Go (`DuplicateGroups`, a union-find over every -book) and only **within one library**. A copy in another library is -deliberate, such as a kids' library holding a book that is also in the main -one, and players already show such copies once. Two books join a group when -they have any of these: +`findDuplicateSets` uses a union-find to group copies within each library. +Health counts those groups. Two books join when any of the following match. - the same audio fingerprint (`content_hash`) and the same total size. The reason is `same_files` only when every member of the group shares that audio @@ -2145,21 +2143,24 @@ Within a group, the copy worth keeping comes first, by: 3. the higher bitrate; 4. more listeners. -A request asks for the open groups, or only the ignored ones with -`?ignored=true`, filtered before paging. A page holds at most `limit` groups -after a keyset `cursor` (500 at most, which is also the size of an unpaged -answer). A paged answer also ends before the group that would take it past 300 -copies (see -[`GET /admin/issues/duplicates`](api/reference.md#get-apiv1adminissuesduplicates)). +With `across`, the duplicates list also holds pairs from different libraries +(`crossMatches`). A match through a third book is enough to connect a group +within one library, but each cross-library pair needs a match between its own +two books. A signal more than 16 books in any one library share +(`maxCrossCopies`), such as a placeholder ISBN, makes no cross-library pairs. +Those books still group within their library and can still pair across +libraries on another signal. Paging is in the +[API reference](api/reference.md#get-apiv1adminissuesduplicates). #### Ignoring and offline libraries -An admin can **ignore** a book under a kind (`issue_ignores`, path-keyed -durable state that moves with the book and survives rebuilds). A duplicate -group is hidden once every member is ignored, and comes back when a new copy -joins it. Libraries whose root is offline are reported beside the categories -(`GET /admin/issues` `offline`), from the same availability probe as the -library list. +An ordinary Health ignore follows the book's path. A split-disc ignore covers +the parent folder, so the set stays ignored when a different disc comes first. +A duplicate dismissal covers the exact group or cross-library pair. See +[Health ignore storage](data-model.md#health-ignores). + +`GET /admin/issues` lists libraries whose root is offline beside the issue +categories, using the same availability probe as the library list. ## Move detection @@ -2187,7 +2188,7 @@ through the fingerprint: `progress`, `bookmarks`, `notes`, `listening_history`, `listening_sessions`, `listening_daily`, `favourites`, `up_next`, `collection_items`, `ratings`, `book_enrichment`, `issue_ignores`, - `book_overrides`, `chapter_overrides`, `chapter_choices`, `chapter_edits`, + `duplicate_decisions`, `book_overrides`, `chapter_overrides`, `chapter_choices`, `chapter_edits`, `book_covers` and `book_matches`. So a rename or move never orphans a user's position, queue entry, collection entry or rating, a book's attached ASIN, an issue an admin ignored, or an admin's edits and custom cover. @@ -2205,8 +2206,10 @@ through the fingerprint: `MoveDurableState` runs **two transactions**, each all or nothing: 1. **The book's own state** (`moveBookState`). `book_enrichment` and - `issue_ignores` move with `UPDATE OR REPLACE`. Then, if the moved book has - any metadata override, chapter override, chapter choice, edited chapter + `issue_ignores` move with `UPDATE OR REPLACE`. The same transaction + rewrites the book's path in every `duplicate_decisions` row that names it. + Then, if the moved book has any metadata override, chapter override, + chapter choice, edited chapter list, custom cover or recorded community match, the destination's rows in **all six** of those tables are deleted first, and the moved book's set takes their place. Edits and cover follow the book as one set, so a stale lock or cover left at the new path by an earlier book can't merge @@ -2246,8 +2249,9 @@ moved book's old and new path, then goes on up while the folder names match. For example, `Author/Series A/Book` moving to `Author/Series B/Book` pairs `Author/Series A` with `Author/Series B`. -`catalog.MoveFolderFavourites` re-keys each pair's favourites, landing once, -like a book's. A pair counts only when: +`catalog.MoveFolderFavourites` carries the folder's favourites to the new path, +landing once like a book's, and moves its `split_disc_set` Health ignore with +them. It does so only when: - every move out of the folder agrees on where it went; and - the old folder is gone from disk **by exact name**. `dirPresent` checks each diff --git a/docs-developers/server/web-ui.md b/docs-developers/server/web-ui.md index 835d1673..f21e3bad 100644 --- a/docs-developers/server/web-ui.md +++ b/docs-developers/server/web-ui.md @@ -1134,17 +1134,28 @@ the book's own parked detect job. ##### Duplicates -Duplicates (`duplicates.tsx`) render each group from -`GET /admin/issues/duplicates` side by side, the copy worth keeping first. -"They're different books" ignores every copy. +The console (`duplicates.tsx`) shows one card per comparison from +[`GET /admin/issues/duplicates`](api/reference.md#get-apiv1adminissuesduplicates). +"Include other libraries" adds a card for each cross-library pair, beside the +cards of the groups within each library. +The console suggests a copy to keep unless a shared identifier points to +recordings of different lengths. + +"They're different books" dismisses only the pair or group on that card. +Undo in the toast restores it, and so does "Suggest as duplicates again" on +the card under "Show ignored". Both send the card's full membership. For a +group over 1,000 copies, `useIssueActions` sends one member with the card's +`key` as [`group_key`](api/reference.md#post-apiv1adminissuesignore--delete-apiv1adminissuesignore), +in a single request. - **Paging.** The groups come 50 at a time (`useDuplicates`, an infinite query on `limit` and `cursor`; `DUPLICATES_PAGE`). A "Show more" button (`LoadMore`) under the list fetches the next page. It also fetches it by itself as it nears the viewport, except after a failed page. The pages already shown stay. -- **Moving groups.** A group that moves across a page boundary between loads - is shown once, where its copies first appeared. +- **Moving groups.** The console shows each comparison `key` once across all + loaded pages. Two cards can share their first copy and still have distinct + keys. - **The count.** "n of total" uses the newest page's `total`, or the groups shown if those are more. - **Covers.** Each copy's cover loads only as its column nears the viewport diff --git a/docs-users/admin/health.md b/docs-users/admin/health.md index 93d2dbe5..86a81c46 100644 --- a/docs-users/admin/health.md +++ b/docs-users/admin/health.md @@ -67,29 +67,42 @@ Under **Long books without chapters**, each book shows its chapter detection job The Bridge is looking for chapters in the narration of **A Long Lecture**. -- **Ignore** hides a book from this list, even through rescans. **Show - ignored** lists them, each with **Show again**. +- **Ignore** hides a book from this list, even through rescans. Under **One + book split into disc folders**, it hides the whole set. The set stays + ignored if you add an earlier disc or rename the folder holding the discs. + Choose **Show ignored**, then **Show again**, to bring a book or disc set back. - Tick several rows (or **Select all**) to act on them together from the bar at the bottom. **Shift-click** selects a run. ### Duplicates -**Likely duplicates** shows each group of copies side by side, with the copy -worth keeping first. That is the better format (M4B/AAC over MP3), then a -single file over several, then the higher bitrate, then the copy more people -listen to. +**Likely duplicates** shows possible copies in the same library side by side. +When AudioSilo suggests a copy to keep, it prefers the better format (M4B/AAC +over MP3), then a single file, higher bitrate and more listeners, in that order. ![Comparing likely duplicates](/img/screenshots/admin/health-duplicates.png) -- AudioSilo never deletes a copy for you. To remove one, delete its files from - the library folder and rescan. -- If they are really different books (two narrations, say), click **They're - different books**. -- **Include other libraries** also compares copies across libraries. +If you want to keep two narrations, for example, choose **They're different +books**. This hides the group and deletes nothing. If you later add or remove a +copy, the books that still match come back as a new group. -Copies that share an ASIN or ISBN but have **different lengths** may not be -copies at all. One may be matched to the wrong recording. Check before you -delete either. +Turn on **Include other libraries** to also see matching pairs from two +libraries. If two copies in your main library both match a third in your kids' +library, you see two pairs. Choosing **They're different books** on one pair +leaves the other pair, and the group in your main library, still listed. + +To bring a group or pair back right away, choose **Undo** in the confirmation +message. To bring it back later: + +1. For a pair from two libraries, turn on **Include other libraries** first. +2. Choose **Show ignored**. +3. Choose **Suggest as duplicates again** on its card. + +The card leaves the ignored list and shows under **Likely duplicates** again. + +If copies share an ASIN or ISBN but have **different lengths**, check for a +match to the wrong recording before removing either one. To remove a copy, +delete its files from the library folder and rescan. ### Series spelled several ways