Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 10-17-2024, 05:15 AM   #1
mpegman
Junior Member
mpegman began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jun 2016
Device: Kobo aura hd
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.
mpegman is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
calibre-debug on Mac scop Calibre 3 10-03-2023 09:47 AM
how to exit calibre-debug botmtl Development 4 08-26-2018 01:15 AM
Cannot run calibre-debug -g Chaaang Development 6 05-26-2017 06:10 AM
Best way to debug Calibre crash? DMcCunney Devices 8 05-14-2017 09:23 PM
Ctrl-Shft-R Debug vs calibre-debug -g JimmXinu Development 3 11-20-2014 09:57 AM


All times are GMT -4. The time now is 10:28 PM.


MobileRead.com is a privately owned, operated and funded community.