View Single Post
Old 03-14-2010, 10:16 AM   #1
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
How the new 0.6.45 Add new formats to existing books option works

A How To Use for a new feature:

Version 0.6.45 added some code that simplifies adding new formats to existing book records. Just drag the new ebook format (or formats) into the main screen and you're done. Calibre will check the database for each book, determine if there is a book with an identical author and a nearly identical title and if the match is close enough, it will add the new format to the existing book entry. You can also use any of the add book options that pull down next to the Add Books icon.

This makes it much easier to bring big collections of books into Calibre. I've dragged in hundreds of books at a time, and they all get sorted into the correct existing ebook record if they are just new formats, or into new records if there isn't already one in the database.

Kovid added a nice notification feature to my code so that after all books are entered, Calibre will list any author/title matches it found. If you drag 5 different formats of the same new book in, it will add the first one, then notify you of the last 4 matches found that were merged into the first record.

For this to work, you need the following:

The option in Preferences|Add/Save needs to be turned on. It's the one that says "If books with similar titles and authors found .."

Next, your book has to actually have a sufficiently similar author and title to the existing book, and you have to have Calibre configured so it can correctly figure out the title and author of the new book.

I prefer to leave the option to "read metadata only from filename" on, then make sure the regex will correctly read the author and title from the filename. If the internal metadata of the book being added correctly specifies the author/title, then you can leave the "read metadata only from filename" off and ignore the regex.

All 3 of these (2 options and regex) are on the same page: Preferences|Add/Save.

In addition to adding the notification feature, Kovid changed my code slightly to handle multiple authors differently and to prevent overwrites of formats you already have. (I preferred to overwrite older copies with the newer copy of the same format, but I understand why he preferred the opposite.)

Multiple authors are now handled as follows: If a new book has multiple authors and the existing ebook record does not, a new ebook record is created. If a new book has a single author and the existing ebook record has multiple authors, the new book is merged (assuming one of the authors matches and the title matches closely enough). (I was lazy with the original code and just matched the first author of the new book against any author of the existing record, so multiple author new books were merged into single author records when author/title otherwise matched.)

How closely do the author/titles have to match:

Author names must match exactly, except for case.

Title matches also ignore case. Leading indefinite articles, like "the", "a" and "an" are ignored, as are most non-alphanumerics. Hyphens, dots (periods) and underscores are replaced with a space before matching. Brackets of various types (parentheses, angle, curly, square) and punctuation, such as, colons and semicolons are removed entirely. Multiple whitespace characters are condensed to a single space. (These changes are only for the comparison - to determine if the new book should be merged into an existing record with a slightly different name.)

Examples:
"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"
"The.diary of.a.madwoman"

but not:
"The Diary Of Madwoman"
"The Diary of a Madwomen"
"Diaries of a Madwoman"

Existing formats are not overwritten (however, my testing shows that you will still get a message saying a merger occurred.)

How to replace a format:

The easiest way is just to right click the existing book, select
"Remove books", then "Remove files of a specific format", remove the format from the old record, then drag in the new format ebook.
Starson17 is offline   Reply With Quote