![]() |
#16 | |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Author title social metadata In your example case. x Merge Comments x Overwrite completely = Replace |
|
![]() |
![]() |
![]() |
#17 | |
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,895
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Kindle PaperWhite SE 11th Gen
|
Quote:
![]() The merge should only concern itself with the main library not the devices. |
|
![]() |
![]() |
![]() |
#18 | |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 454
Karma: 270240
Join Date: Aug 2009
Device: Sony PRS 650, PocketBook 360, Astak PocketPro (RIP), Tungsten T3
|
Quote:
With your merging scheme and the check boxes recommended by TheDucks, this process would become much more simple for me. I'm with Kovid on not autodeleting duplicate formats. 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 think there would need to be some checkboxes for merging metadata too, since Calibre reads it from the file and inserts what it can. 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. I would add one to TheDucks list. x Add book but retain existing metadata. It's more intuitively obvious to me to move the new book into an existing record versus adding the entire existing record to the new book's record. Either way, I agree that one of the steps in a merge should be deleting the duplicate. |
|
![]() |
![]() |
![]() |
#19 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
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:
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. |
||
![]() |
![]() |
![]() |
#20 | ||
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 454
Karma: 270240
Join Date: Aug 2009
Device: Sony PRS 650, PocketBook 360, Astak PocketPro (RIP), Tungsten T3
|
Quote:
By the time the merge hits, I would have to have looked at what I already had versus the new version and decided that the new version was better. But call me a coward. I don't delete nuttin' until I know for sure that the other one is safely in the record. None of my new stuff is in ePub and all of my new stuff is, so I suppose I can be cowardly without losing anything. I have no interest at all in having more than one record for the same book. Quote:
I think this sounds like a great improvement and really appreciate you putting the time and effort into making it happen. |
||
![]() |
![]() |
![]() |
#21 | |||||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||
![]() |
![]() |
![]() |
#22 | |||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
As I use the code on my own data, I've slowly made some changes from how I first planned it:
Quote:
Merge into 1st selected record, delete other records after merge. Merge into 1st selected record, keep other records after merge. If you use the first option, you get as much metadata as will fit into the first record. Any empty fields will be populated from the other records, but duplicate formats, different authors, different titles, different series names, etc. found in the second record will all be deleted when the second and other records are deleted. You end up with only one record, and that record can only contain one author, one title, one publisher, one cover image, etc. Everything in the first record is always safe and never gets overwritten. If there's anything in the second record that you definitely want to keep, you can always delete that item from the first record and it will get moved from the second record into the empty slot in the first during merge. If you use the second option, the first record is treated,just as above, but the other records are not deleted. It's a sort of "safe" merge, but it does leave you with the extra records. I could delete formats from the second and other records, but I think it's safer to leave them completely untouched. If you accidentally merged the wrong records, all you would have to do is delete out the wrongly added stuff from the first record. If the merge was correct, all you'd have to do is manually delete the extra records. This would also provide a back door ability to shuffle metadata around. Delete the rating and publisher from the first record and safe merge with a second and the first gets the rating and publisher from the second. Yes, it would also get other metadata in any empty metadata slots, and that would have to be deleted, but it might be useful. Quote:
Quote:
What about author/title? I think author is filled with "Unknown" if it's blank. That is a valid author, but should it be overwritten if a merge record has some other author name? (If I overwrite the author in this one case, then I'd also overwrite the author_sort field) I'm not sure about title. Can that field be blank? (I'm not at home to test this stuff) The date and pubdate fields never seem to be empty, so I'm ignoring them. Any comments? Last edited by Starson17; 03-24-2010 at 02:12 PM. |
|||
![]() |
![]() |
![]() |
#23 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Unknown is a valid Author in my collection as I failed to note an Authors name on some FanFic that did not contain the Author in the body.
Unknown is not = to Anonymous ![]() Does Calibre allow a blank Author or Title? I think the SQL sets them to the default "Unknown" if left blank |
![]() |
![]() |
![]() |
#24 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
In mine, too. However, suppose you are merging two books, and one has author Unknown, and the other John Smith. Do you want to overwrite Unknown with John's name or not?
Quote:
Generally, I assume I don't want to change author/title in the first selected record during merge, but maybe these are special cases where I should consider "Unknown" to be a blank field. |
|
![]() |
![]() |
![]() |
#25 | |||
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Quote:
Code:
CREATE TABLE authors ( id INTEGER PRIMARY KEY, name TEXT NOT NULL COLLATE NOCASE, sort TEXT COLLATE NOCASE, UNIQUE(name) ); CREATE TABLE books ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL DEFAULT 'Unknown' COLLATE NOCASE, sort TEXT COLLATE NOCASE, timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP, uri TEXT, series_index INTEGER NOT NULL DEFAULT 1, author_sort TEXT COLLATE NOCASE, isbn TEXT DEFAULT "" COLLATE NOCASE, path TEXT NOT NULL DEFAULT "" ); You would never combine something into a "Unknown" title and I can not see a reason setting a "Known" title to "Unknown" How would you know which was which when combining without at least one decent title displayed. Quote:
Congratulations taking on this task. IMHO designing a well thought out UI is very difficult. |
|||
![]() |
![]() |
![]() |
#26 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,251
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
If you are special casing Unknown, be sure to use _('Unknown') so it works with languages other than english as well.
|
![]() |
![]() |
![]() |
#27 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
After looking at the code, reading comments here and thinking about it for a while, I think it makes sense to overwrite blank author/title fields (which Calibre fills with "Unknown") in the destination record (first selected) when the source record (second or subsequently selected record) has something other than "Unknown" in those fields. Author and author_sort will always be brought in as a pair, title will be treated separately.
This will treat the author/title fields as though they were empty if they have Unknown in them. Doing it this way also allows you to make a copy of a record by creating an empty record (from Add Book) then doing a safe merge into the empty record from another record. The empty record will have Unknowns in the author/title fields, and the safe merge will fill the new record with metadata from one or more subsequently selected records. |
![]() |
![]() |
![]() |
#28 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Edit: Ignore the question below. As usual, when you think through the question well enough to ask it, the answer often becomes obvious. If you read this, and can recall, I've got one last minor feature I'd like to add before final cleanup ("final cleanup" is where I try to hide all my ugly hacks before I'm found out). After merge, I'd like to leave the records involved with the merge operation selected (i.e. highlighted in the interface). For safe merge, that's easy, since I haven't removed any records and haven't changed the selection/highlighting in the interface. Whatever was highlighted/selected, remains highlighted/selected and there's a visual indication of what records were just processed. If a user wants to convert a safe merge to a normal merge, they can just deselect the first selected record (destination record) and hit delete. However, I'm having trouble with a normal merge where I'd like to leave the highlighting/selection on the destination record so that the user can view or modify it. Currently, all the rows that were highlighted before merger remain highlighted after merger, and due to the removal of records above the destination record and deletion of merged records, these highlighted rows often have nothing to do with the merge operation. Prior to merger and deletion of the second and subsequently selected records (source records), I know the book index from the database and the row number in the library_view GUI interface for the destination record. I also have the same information for the source records (which disappear after merge). If the first selected record is the "highest" row in the GUI, then the removal of the lower (source records) doesn't change its row # , but that's often not true. The first selected record might be the bottom record in the view, and removal of the other records above it cause its row # to change. I can see how to select a record by row #, but is there a function that selects a record in the GUI by its library book id? If not, I'll write one to figure out the row # of the remaining record by comparing row #s of the source and destination records. Last edited by Starson17; 03-25-2010 at 08:55 PM. |
|
![]() |
![]() |
![]() |
#29 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Adds Merge books option to right click and toolbar. Select a first book, then books to merge into it. Formats and metadata are merged into the first book. No data or formats in the first book (destination) are overwritten (unless author or title are "Unknown"). Tags and comments are concatenated unless they match. Author and author_sort are moved as a unit, as are series and series_index. ISBN is not merged (my preference - easy to change). Subsequently selected books (source) may be removed after merge or left untouched (safe merge). By safe merging into an empty book, a book and all its formats may be duplicated (useful to play around with format1->format1 conversions without risking the original format). Highlighting always remains on the selected books after normal and/or safe merge. |
|
![]() |
![]() |
![]() |
#30 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
In one case, I had added a book that had title only, but it was similar to some books I was working on that had lots of metadata, and the same author. Since all books by this author were pdf's, I just safe merged an old book into the new one. The new pdf format wasn't overwritten and all the other metada was copied into the new record. In another case, I was experimenting with HTML to EPUB conversion and wanted to change the metadata put into the EPUB but not change my good record. I created an empty record and safe merged books and data into it. Then I was free to experiment in the copy. I wanted normal merge to merge up duplicate records that I'd inadvertently created during initial book entry. However, now that those are mostly cleaned up, I've found I use normal merge less, but I still use safe merge to do things unrelated to true record merger and more related to record and metadata copying and shuffling. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Merge records | mruseless | Library Management | 6 | 04-16-2014 09:01 AM |
Merge book records doesn't copy author and title ? | JackLiu | Calibre | 4 | 09-25-2010 11:36 PM |
Merge feature request (different merge) | Tarran | Calibre | 1 | 05-24-2010 10:57 AM |
Help with Merge Records - an SVG icon | Starson17 | Calibre | 3 | 03-26-2010 01:20 PM |
Developers...large format reader to review your code and annotate changes? | brecklundin | News | 13 | 09-22-2009 07:25 AM |