Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old Today, 11:12 AM   #1
foosion
Connoisseur
foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.
 
Posts: 95
Karma: 4562
Join Date: Sep 2011
Device: Kobo Libra 2
Reading Calibre DB

I'd like to read the Calibre DB from a python program.

I can get a list of my books with:

Code:
import sqlite3

fname = "c:/Calibre Library/metadata.db"
con = sqlite3.connect(fname)
cur = con.cursor()

cur.execute("SELECT * from books")
for item in cur.fetchall():
    print(item)

con.close()
How do I access a custom field? I've created the field "read" which is the date I finished reading the book (or blank)?

Here's a typical output from the above:

(3025, 'A Short History of the Italian Renaissance', 'Short History of the Italian Renaissance, A', '2024-07-06 20:20:52.809814+00:00', '2015-07-15 04:00:00+00:00', 1.0, 'Bartlett, Kenneth R.', '', '', 'Kenneth R.
Bartlett/A Short History of the Italian Rena (3025)', 1, '1e6fc84c-3ab1-459b-810f-543895ac556c', 1, '2024-07-17 01:30:42.096682+00:00')

This seems to be: index, title, title_sort, date_imported, date_published, author_sort, ???, path, ???, date_???

I'd guess this is documented somewhere obvious, but my search skills are failing to find the specific location.
foosion is offline   Reply With Quote
Old Today, 11:31 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,125
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://manual.calibre-ebook.com/develop.html
https://manual.calibre-ebook.com/db_api.html
kovidgoyal is offline   Reply With Quote
Old Today, 12:09 PM   #3
foosion
Connoisseur
foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.foosion is fluent in JavaScript as well as Klingon.
 
Posts: 95
Karma: 4562
Join Date: Sep 2011
Device: Kobo Libra 2
I was hoping there was documentation identifying the fields I listed as ??? and an easy way to access the custom field I created. I'd have thought it would be another line or two of code.

It appears that I have to install the Calibre source and study and use its API?

Thank you for a fabulous and tremendously useful program!
foosion is offline   Reply With Quote
Old Today, 12:17 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,125
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You dont access it using sqlite. Use the calibre API. it is documented, yes you will need to read some documentation and install calibre.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading and printing with Calibre balubeto Calibre 8 03-11-2018 01:25 PM
Calibre not reading Kindle lovingthereading Devices 0 05-12-2016 11:28 AM
Problems Reading Some Calibre Library Books Using Calibre Companion eurasiarc Calibre Companion 17 09-28-2013 02:45 PM
Calibre not reading second library Ladyhenry Library Management 1 02-17-2013 08:29 PM


All times are GMT -4. The time now is 01:38 PM.


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