Quote:
Originally Posted by kovidgoyal
@charles: Yes that's fine.
|
PR pushed
@kjdavies:
Once the above PR is accepted (
it is accepted), and once it is released if you are not running from source, this script merges metadata from N books into one.
EDIT: merge_book_metadata() was moved to become a db new_api method. I changed the script.
Code:
from calibre.db.legacy import LibraryDatabase
if not LibraryDatabase.exists_at(sys.argv[1]):
print(f'no such library or not a library: {sys.argv[1]}')
exit()
db = LibraryDatabase(sys.argv[1])
ids = sys.argv[2:]
if len(ids) < 2:
print('must supply at least 2 ids')
ids = [int(i) for i in ids]
dest_id = ids[0]
ids = ids[1:]
db.new_api.merge_book_metadata(dest_id, ids)
You run it with
Code:
calibre-debug -e path-to-script path-to-library book_id book_id [book_id *]
The first book_id is the target for the merge.