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 03-16-2011, 06:29 PM   #1
GreyNomad
Junior Member
GreyNomad began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2009
Device: Kindle 2
Getting book's id number programatically

Is there a faster/easy way to get the id number of a book through an API function? The only way I have found to do this is to execute calibredb with the 'list' function and scan the returned list for the book title and author. With a large catalog, that can take a considerable amount of time.

I have to think there must be a faster, and hopefully easier, way.

Thanks,
~~ Grey
GreyNomad is offline   Reply With Quote
Old 03-16-2011, 09:13 PM   #2
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
How are you accessing calibre? Through a plugin? Though an external app that gets and then manipulates the data?

If you're using a plugin you can get the database object from the library_view. Then calibre.library.database.LibraryDatabase can return the id for an index.
user_none is offline   Reply With Quote
Advert
Old 03-18-2011, 12:48 AM   #3
GreyNomad
Junior Member
GreyNomad began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2009
Device: Kindle 2
I'm sorry, I should have provided that information. I am accessing Calibre from an external program (written in Perl).

~~ Grey
GreyNomad is offline   Reply With Quote
Old 03-18-2011, 04:16 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,742
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
By "accessing Calibre" do you mean accessing calibre's database? If so, then do the SQL query to look up the record. If you are running calibre's command line programs from perl, then you might consider using a calibredb to dump a list of all the books, load them into a dict, and then look them up there.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I use Calibre to change a book's cover? Mike L Calibre 8 08-24-2013 12:26 AM
PRS-950 Book's there, where are the pages? Flygrl Sony Reader 9 06-06-2011 05:41 PM
E-book's you want to see being made? ebook creator General Discussions 29 03-14-2011 06:49 PM
How to change the way Calibre save book's filename? vne Calibre 4 10-21-2010 12:41 PM
Could lack of piracy be the e-book's demise? TadW News 44 02-12-2009 05:34 PM


All times are GMT -4. The time now is 02:26 PM.


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