Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 05-26-2014, 02:14 PM   #1
kabirmaar
Member
kabirmaar began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Feb 2014
Device: none
having metadata.opf, cover.jpg + title.[pdf|epub|..] what's the best function to use?

If I have metadata.opf, cover.jpg + title.[pdf|epub|..] in the same folder and want to add that book to current (running) calibre library what's the best calibre function/method to use from plugin?

something like:

book_folder/
metadata.opf
cover.jpg
title.pdf
title.epub

calibre.deep_inside.add_book(path_to_folder)
or
calibre.deep_inside.import_book('path/to/book_folder/metadata.opf', formats['path/to/book_folder/title.pdf', 'path/to/book_folder/title.epub'], 'path/to/book_folder/cover.jpg)

I found quite few hints looking at source but couldn't figure out what would be "the right way" to do that. I know I can also do that with CLI calibredb but would rather do that through internal calibre call.
kabirmaar is offline   Reply With Quote
Advert
Old 05-27-2014, 08:03 AM   #2
kabirmaar
Member
kabirmaar began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Feb 2014
Device: none
Code:
from calibre.gui2.ui import get_gui
get_gui().current_db.import_book_directory('path_to_folder/')
kabirmaar is offline   Reply With Quote
Old 06-21-2017, 03:33 PM   #3
mpuech
Junior Member
mpuech began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jun 2017
Location: France
Device: Kobo Aura 1
Hello,

I've tried
max@pc-max:~$ from calibre.gui2.ui import get_gui get_gui().current_db.import_book_directory('/home/max/Bibliothèque calibre/Collectif/test/')

But i've got:
bash: erreur de syntaxe près du symbole inattendu « ( »

Thanks for your help
mpuech is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extra id in id line of opf after use of epub metadata editor program mrmikel Editor 3 02-22-2014 07:53 AM
Change opf filename from content.opf to title.opf northstar7 Sigil 3 09-23-2013 12:44 PM
cover.jpg & metadata.opf BetterRed Calibre 1 05-10-2013 10:29 PM
Custom columns to call up metadata from epub's opf? eosrose Library Management 1 03-21-2013 04:33 AM
Calibre changes size of cover.jpg when copy to new Libary --> see PDF attached icq70610 Calibre 5 10-02-2010 01:29 PM


All times are GMT -4. The time now is 07:46 AM.


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