Ticket #5016 (closed enhancement: fixed)
Add formats to existing ebook records
| Reported by: | Starson17 | Owned by: | kovidgoyal |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | Default | Version: | trunk |
| Keywords: | Cc: |
Description
The attached code adds a new checkbox option to the Add books Preferences page. With the box checked it uses the author and title from any book(s) being added, searches the Calibre database to find the book(s), and if they exist, adds the format of the new book to the existing record (or creates a new record if not found).
It works with drag/drop and all 3 options on the Add Books pulldown.
It's intended to deal with bulk adding of ebooks, but it also simplifies updating of an existing ebook format.
With the current design, Once an ebook entry is made, there's no way to update it or to add new formats to it.
Note that this code overwrites "identical books" when format, author and title match. Author matches must be exact, but title uses a fuzzy match(ignore case and leading indefinite articles ("the", "a", "an") , change underscores and periods to spaces and strip punctuation. So for example:
"The Diary of a Madwoman" matches all these (and vice-a-versa):
"The Diary Of A Madwoman" "Diary of a Madwoman" "The_Diary_of_a_Madwoman" "The Diary; of a Madwoman" "the.diary.of.a.madwoman"
but not: "The Diary Of Madwoman" "The Diary of a Madwomen" "Diaries of a Madwoman" "Diary of a Madwoman, The"
I've added the best cautions I can think of in the option description and Tooltip.
Default behavior is unchanged (checkbox is default off).
Attachments
Change History
Changed 7 months ago by Starson17
-
attachment
my-changes
added
comment:1 Changed 6 months ago by Starson17
BTW, I put some SQL query code into the add.py module and imported generic SQL support from database2.py to do the necessary searching I needed. I suspect there may be a predefined function in database2.py that would do the search, so I didn't have to write my own SQL. It struck me that you might want to keep the SQL stuff in database2, but I didn't spend much time going through it looking for a search function.

Add formats to existing records