Quote:
Originally Posted by chaley
Re merging: I haven't touched that part of calibre. I never use it so I can't even describe what it does.
|
I know that someone, probably Kovid, improved it after I last touched it. I thought it might have been you.
Quote:
I do know that db.set_metadata will update custom columns from a metadata object, but I have no idea if abd when it is called. I can imagine merging working one of three ways: the existing record has the master metadata, the new record has the master metadata, or fields in the new record that are not in the existing record are added. The last one isn't exactly easy to do.
|
Options 1 and 2 are built into the Merge code, which works inside a single library. The first record selected in a Merge operation is the master, no matter how many records are being merged. The second selected has priority above all others except the first, etc.
I don't need to, nor am I interested in tackling number 3 - new field creation.
I was thinking that there would be three options for CTL Automerge operations:
1) destination is master (don't change fields in the destination, but add data from the source or fill in blank fields when a format from the source is added to a record in the destination)
2) source is master (change fields in the destination to match source data, and add data to supplement or fill in blank field data when a format from the source is added to a record in the destination), and
3) function as it currently functions - make no change to metadata in the destination record, just add the new format into the existing record according to the Add settings (overwrite or skip)
New record creation rules would remain unchanged.
I suppose this could be useful for the Find Duplicates code as well. There are times I want to just merge them all, and not have to go through all the found dupe groups.
Quote:
You seem to be saying that you want the new record to be the master. I don't see that as an option, but it should be possible to do. You would call set_metadata on the existing record, giving it the mi from the new one, possibly setting force_changes=True
|
Usually I want the old/destination record to be the master. I just want empty fields in the destination library to be filled in if the the new record has data there when the Automerge criteria is met and an incoming format is going to be added to an existing record. For multi valued fields, like tags or #genre or description/comments, I'd like the contents of the incoming source record to be concatenated to the destination record so that the minimum amount of data is lost during the CTL merge process. All of that is handled in the Merge code now. It would be the rough equivalent of doing a CTL with automerge turned off followed by a Merge for all records that meet the Automerge criteria where the old/destination record is selected as master for the merge (option 1 above) or where the new/source record is is selected as master for the merge (option 2 above).
It's nice to hear from you
(BTW, I'm not really proposing that I write this for others. As usual, my skills are too poor to do anything other than hack together something to solve my immediate personal problem of reassembling multiple recovered databases.)