![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 293
Karma: 21022
Join Date: Mar 2011
Location: NL
Device: Sony PRS-650
|
Cli-usage in plugins
I would like to use the command line interface of calibre in one of my plugins.
Is there a posibility to do so? The idea is to create a plugin that can perform multiple-database actions (like syncing of some data). Edit: In the manual I found information about the cli and about plugin creation, but not about howto execute cli-tasks via plugins. Last edited by drMerry; 09-24-2011 at 09:09 AM. |
![]() |
![]() |
![]() |
#2 |
Sigil & calibre developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,487
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
|
I see absolutely no point in what you're asking. A plugin has full access to the API and can call the required functionality programatically. What exactly do you want to do with the db calls?
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 293
Karma: 21022
Join Date: Mar 2011
Location: NL
Device: Sony PRS-650
|
Hmm, so all functions in the cli are available by the API.
I'll look at it. What I'm planning to do is e.g. requesting columns from the current database and from a remote database. So I can display them and show the differences with the option to sync (saying update data in one of the databases or add column in remote database. |
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
You would probably be better off writing your own query programs that produce output in some known format such as CSV. You would use python's os.system() API to execute the query on the read-only library, and calibre's API to get the info for the read/write library. Or something like that. |
|
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 293
Karma: 21022
Join Date: Mar 2011
Location: NL
Device: Sony PRS-650
|
hmmmm...
I was thinking of using the cli. the cli interface has some options to set and get information from the database. So I would use calibre for the current db and get / set (some) info of the other database using calibre-cli |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,188
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
There is no need to use the cli, just create a new LibraryDatabse2 object to connect to the other library. See for example the code in actions.copy_to_library
|
![]() |
![]() |
![]() |
#7 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 293
Karma: 21022
Join Date: Mar 2011
Location: NL
Device: Sony PRS-650
|
of course I could wirte another app, but the nice thing is to have it integrated in calibre.
If I want my own app to be integrated in calibre, I can see 3 ways: 1. Starting my app by calibre using a cli-command 2. Starting my app by user before or during calibre 3. Run my app seperately from calibre Oprion 2 and 3 are not user friendly. Option 1 will need the same function as requested in first post |
![]() |
![]() |
![]() |
#8 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 293
Karma: 21022
Join Date: Mar 2011
Location: NL
Device: Sony PRS-650
|
|
![]() |
![]() |
![]() |
#9 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,336
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Note that some parts of calibre assume that there is one library open. Two I can think of are user-define template functions and saved searches. There are probably others.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Accessing built in recipes via CLI? | jbmia | Recipes | 7 | 07-22-2011 02:25 PM |
Add book by CLI | plalloni | Library Management | 3 | 03-01-2011 04:15 PM |
Struggling with CLI | Paulinafrica | Calibre | 4 | 01-08-2011 02:04 PM |
Adding online metadata using ISBN from CLI | EditorJack | Calibre | 17 | 01-20-2009 01:47 AM |
prs505 cli | ees | Calibre | 3 | 01-10-2009 03:27 AM |