Originally Posted by _Em
Sorry to revive an old thread, but I'd like to keep the context of what's already been said.
According to calibredb --help, you can either add duplicates (and have to clean it up using merge from the gui later), or add by unique title, skipping files of the same title in a new format. There doesn't appear to be a way to add new formats to an existing book from the command line (no command line merge function either). Am I missing something, or has someone hacked up a script that will accomplish this?
Do I have to rip apart a few plugins to create a command line script to do this? I have found adding by command line to be orders of magnitude faster than using the GUI (either via interface or by dragging books over the window -- my preferred method).
What I'd really like to do is write a script that traverses a directory structure, verifies that my to-be-imported books have the correct naming format to be imported correctly, and then imports all of those books, correctly merging books with the same author and title. After this, the script would then trigger mekk's ISBN detection script, and after that would trigger the gui-style download metadata script.
Right now, this does not seem possible without scripting the GUI itself (which seems a bit backward, as the GUI is generated by scripts in the first place).
I did the code for Merge and for AutoSort/AutoMerge (put new formats into existing records where author/title fuzzy match). On the issue of command line merge, how do you plan to identify the merge records? The GUI merge takes the selection made by the user for source and destination records, finds the book ids to access the records in the library and goes from there. If you have the book ids, you can use the code from the command line (calibre.library.database2 import LibraryDatabase2) with calibre-debug -c or -e. Give me the record ids and I can give you the command line code.
As to "verifies that my to-be-imported books have the correct naming format to be imported correctly," if you can code this, it would be useful for the GUI, too. I'm not sure how you tell a title, from a series, from an author.