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 05-08-2012, 01:43 PM   #1
robertsoakes
Junior Member
robertsoakes began at the beginning.
 
Posts: 1
Karma: 10
Join Date: May 2012
Device: Nook Color
Adding new books to the library

Dear Developers,

I am currently working on a plugin to enable cloud synchronization for Calibre. So far, I've got it doing simple things, such as downloading a catalog from a remote server, comparing it to the local database, merging records, and then pushing updates back to the remote server.

While working on it, though, I've found that I don't quite understand the database interface. What is the best way for a plugin to add new books to the database? Is there anywhere that I can find code examples or is it covered in the developer documentation?

Likewise, how can I retrieve the URLs for different formats of the book that are installed? Since I've got metadata sync (mostly) working, the next thing I'd like to do is file synchronization.

Any pointers would be extremely appreciated.

Cheers,

Rob Oakes
robertsoakes is offline   Reply With Quote
Old 05-09-2012, 01:01 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,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If your plugin is running in the GUI process use the database like this

gui = get_gui()
db = gui.library_view.model().db
db.add_books(...)

see database2.py for the methods db supports.

If your plugin is running out of process use

calibredb add

As for getting files from the content server, its a simple URL scheme just look at a few of the urls generated by the content server for file downloads, or look at the code in server/content.py
kovidgoyal is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about Adding Books and Library Location... Nalapombu Calibre 1 02-17-2012 10:34 PM
Can't seem to get started adding books to library from Kindle for PC yunti Calibre 7 03-23-2011 05:03 PM
adding library books to Calibre gudrun45 Library Management 1 02-13-2011 12:31 PM
Adding Books to Device Library remus.grrrl Devices 4 02-10-2011 03:06 PM
Duplicates ! and adding new books to library anickson Calibre 4 10-11-2010 03:48 PM


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


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