learning about calibre-debug
I'm trying to run some batch jobs using python and calibre-debug -c
command = (
f"from calibre.library.database2 import LibraryDatabase2; "
f"db = LibraryDatabase2('/Calibre/'); "
f"db.conn.execute('UPDATE books_languages_link SET lang_code={lang_id} WHERE book={book_id}'); "
f"db.conn.execute('UPDATE custom_column_4 SET value=1 WHERE book={book_id}'); "
f"db.conn.commit();"
I suppose that this does not do anything if there is not already a language populated nor a custom_column_4 entry made for this particular book (like an upsert).
Is there a more intelligent way to do this that directly checks if this needs updating or inserting via calibre-debug? I've seen some nice ones in this forum.. but I don't understand the syntax
is there a sort of guide on how to construct these statements properly?
many thanks for your help!
Last edited by mpegman; 10-17-2024 at 01:20 PM.
|