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-21-2014, 05:23 PM   #1
JupiterJones
Junior Member
JupiterJones began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Aug 2014
Device: Kindle
Access custom fields from metadata DB

Hello,

I try to write my first Calibre plugin and have some problems extracting especially the custom fields with the db api.

what I do is this:


Code:
  db = self.gui.current_db.new_api
        book_ids = self.gui.library_view.get_selected_ids()
        
        for bid in book_ids:
            
            lh =  db.get_metadata(bid)
Then I access the data with lh.pubdate, lh.title etc.

But how can I access the custom field to store them in variables ?
JupiterJones is offline   Reply With Quote
Old 10-21-2014, 10:29 PM   #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: 43,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
db.field_for('#mycolumn', book_id)

or

lh.get('#mycolumn')
kovidgoyal is offline   Reply With Quote
Advert
Old 10-22-2014, 07:48 AM   #3
JupiterJones
Junior Member
JupiterJones began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Aug 2014
Device: Kindle
Works thank you
JupiterJones is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding custom fields to the main UI karimnaguib Library Management 5 10-06-2013 09:27 PM
Sorting books on disk with custom fields Fleckenteufel Library Management 0 10-30-2012 11:55 AM
question on custom fields Keltari Library Management 5 08-26-2011 02:58 PM
copy between libs, keep custom fields drMerry Library Management 1 05-24-2011 06:56 PM
Catalogs & Custom Fields nynaevelan Library Management 14 10-27-2010 04:55 PM


All times are GMT -4. The time now is 09:34 PM.


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