Ticket #5016 (closed enhancement: fixed)

Opened 7 months ago

Last modified 6 months ago

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

my-changes Download (12.1 KB) - added by Starson17 7 months ago.
Add formats to existing records

Change History

Changed 7 months ago by Starson17

Add formats to existing records

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.

comment:2 Changed 6 months ago by kovidgoyal

I'll look at this in a bit, swamped right now.

comment:3 Changed 6 months ago by kovidgoyal

  • Status changed from new to closed
  • Resolution set to fixed

Implemented in branch trunk. The fix will be in the next release.

comment:4 Changed 6 months ago by kovidgoyal

The implementation is slightly different from your proposal. It handles multi author books correctly and if a book has an existing format it is not replaced. The user is notified of all merges that happened.

Note: See TracTickets for help on using tickets.