Readwyn 0.1.0

How to find and merge duplicate books without calibre

Readwyn looks for duplicates by itself. Click “Library health” in the sidebar (it sits after Stats, with a count next to it) and open Duplicates: each group there is a set of books that look like one book, with the reason they matched. “Merge…” on a group lets you pick the book to keep, and “Merge” folds the others into it.

How two books match

Every book is compared with the other books of the same library, and a match gets one of three strengths. Groups come strongest first.

LabelWhat matched
“Same edition”The ISBN, or the Open Library edition ID
“Same text”The text of the books
“Same book, other edition”The Open Library work ID, or the title and the authors

Each group names its reason, for example “ISBN 9780141439549”, “The text of the books matches”, or “Same title and author”.

ISBNs are compared as ISBN-13, so a book with the ISBN-10 and another with the ISBN-13 of the same edition still match. An ISBN with a wrong check digit matches nothing. It turns up under Checks as “Invalid ISBN” instead (how the check digit works).

Titles and authors are folded before they're compared. Case, accents and punctuation drop out, a subtitle after the first colon is ignored, and so is a leading “The”, “A” or “An”, or the leading article of a French, German, Spanish, Italian, Portuguese, Dutch or Swedish book. Authors written “Last, First” are turned round, and initials are joined, so “J.R.R. Tolkien”, “J. R. R. Tolkien” and “Tolkien, J. R. R.” are one author. The books keep their own spellings, and Checks lists them as “One author, two spellings” (how to settle on one). A book with no author, with the author “Unknown”, or with the title “Untitled” never matches on title and author, because too many books would.

The work ID comes from Open Library: when you fetch metadata for a book, Readwyn stores the work of its edition as “Open Library work” in Edit details. With it, two editions of one work find each other even when their titles differ. A book you've never fetched has no work ID and matches on title and authors only.

Same text, different files

“Same text” catches a book that came in twice with no shared details at all: a PDF under one title and an EPUB under another. Readwyn takes a small fingerprint of the words of each book (four samples, chosen by their content rather than their position) and calls two books the same text when three of the four agree.

New front or back matter rarely changes it. The test for this adds a preface of 1,500 words and notes of 1,200 words to a text of 60,000 words, and the fingerprint still matches. A text under 1,000 words gets no fingerprint at all, since samples and picture books would match far too easily. Comics don't use it either: a comic matches only another comic with the same series, number and volume.

Before you merge

Each book of a group shows its cover, title, authors, formats, size, date added, status and progress, number of highlights, and shelves, side by side. That's usually enough to tell a real duplicate from two books that only share a name.

If they aren't the same book, click “Not duplicates”. Those books don't match each other again, and the choice is stored in the library itself.

The merge sheet

“Merge…” opens “Merge 2 books” with one line of instruction: “Choose the book to keep. It gets the files and the reading data of the other book, and the other book is removed.” The first book of the group is chosen to begin with. Click “Keep this book” on another to switch.

Under Files, each format is listed with where it comes from. If both books have an EPUB, the sheet says “both books have one. Choose the file to keep.” and shows the size and date added of each. A format only the other book has, a MOBI for instance, just comes across. “The kept book gets” then lists what moves: the shelves, the number of reads, the highlights and notes, and identifiers such as Goodreads.

After “Merge”, the kept book has:

  • Files: its own, plus every format it lacked. Where both books had a format, the file you chose. A file that comes across brings its converted EPUB 3, if it has one.
  • Cover: its own. If it had none, the cover of the first other book that has one.
  • Shelves and reads: both sets together. A read with the same start, finish and outcome in both books counts once.
  • Highlights, notes and bookmarks: all of them. A highlight that can't be placed in the kept copy's text shows under “Not found in this copy” instead of being lost.
  • Time read: every reading session that Readwyn recorded for the other books. The time read that a Kobo reported comes across only if the kept book has none.
  • Status, progress, rating and review: the kept book's. A missing value is taken from the first other book that has it.
  • Identifiers: its own, plus any scheme it didn't have.

The other books are then removed. The files that didn't come across stay on disk until you click “Compact” in Settings › Libraries. If the removed book was on your Kobo, its place on the device moves to the kept book, unless the kept book is on that device too. In that case the removed book's copy stays on the device as a file that belongs to no book of the library.

A merge is one change to the library. A second Mac that shares the library applies the same merge.

Duplicates that never get in

“Add books”, and a drop onto the window, check each file before it comes in. A file with exactly the same bytes as a stored file is skipped. A file that matches a book at one of the three strengths waits in a review titled, for example, “2 books look like books you have”. For each file you choose “Add to that book” (only offered when that book has no file of the format), “Add as a new book”, or “Skip”. If one drop holds two copies of a book, the second copy waits for the review too.

The calibre import doesn't stop to ask. When it ends, Duplicates lists whatever matched, and you merge from there.

Who can merge

Anyone at the Read level sees the panel. “Merge…”, “Not duplicates” and the choices of the “Add books” review need Admin, so a Mac at Read sees the groups without the buttons.

Merging duplicates isn't “Merge into one book…” in the “…” menu of the selection bar. That command joins different books, such as the volumes of a trilogy, into one new EPUB, and the new book starts without their highlights and reads.