Quantcast
Channel: MobileRead Forums
Viewing all articles
Browse latest Browse all 50069

Reading Calibre DB

$
0
0
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.

Viewing all articles
Browse latest Browse all 50069

Latest Images

Trending Articles



Latest Images