Quote:
Originally Posted by polly
Just because they're both ePubs doesn't mean they're identical. Perhaps there could also be a check box for which version to keep?
|
I'm trying to keep it simple. At least with this first version it's going to be a true merge, which means at the end of the merge, there's only going to be one record left - the one you selected first. In that sense, it's just like the "Remove selected books" (delete) code, which the merge code I'm working on closely follows.
The main difference between merge and delete will be that merge will keep as much of the data in the records you are removing as Calibre permits. It may make it easier to understand if you just think of merge as a less drastic alternative to delete.
If you want to keep multiple copies of the same format, then you aren't really merging records. It might be nice to have some code to shuffle metadata and formats around, but that's not really what I'm trying to write.
If the EPUB's in your case aren't identical, and you still want to do a merge, then you're going to have to decide which version to keep. That means you're going to have to open them up, view them, etc. If you're going to do all that, you might as well just delete the EPUB format you don't want before you do the merge, and the issue of overlapping formats doesn't arise.
Quite honestly, it's a lot harder to write code that gets down to the level of comparing formats and putting in checkboxes for various options to deal with conflicts than it is to just deal with the ebooks at the level of the entire ebook record.
Of course, these comments apply to the code I'm writing for my personal use. Kovid is the final arbiter of what goes into Calibre. I want to be able to choose two or more records, and merge them without having to look at and compare all the individual formats. I recognize that what I want may not be what best meets the needs of others, but it's where I'm going to start.
Quote:
If my original book has all of the series information, the tags, a cover that I had to hunt down online, and a description, I'll want to keep all of that, even though I'm bringing in a book with better formatting.
|
The code is rough, but is basically working now to do this. No checkboxes are required. It does not overwrite any formats or metadata in the first selected record. It brings in all the formats and metadata it can from the second selected record and then from the third, etc. If a metadata field is empty in the 1st, but not the second, it brings in the data from the 2nd, etc. For the comments metadata field, it concatenates the second record onto the first unless they are identical.
I still have to write the code that deals with moving the cover image if the 1st has none. I have some minor bugs in the tag code I know about. I want to clean up some of the code so it's easier to read, I've got some checking to do on how Kovid handles certain non-ascii chars and OS related issues, then I need to test it for a while on my own data. Then I'll send it off.