10-25-2012, 11:58 AM | #1 |
Grand Sorcerer
Posts: 6,206
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Help viewing calibre gui data via commandline
I am trying to get a better understanding of the calibre library data available when creating a typical user interface plugin. Please could someone get me started.
As an example, some simple code I already have in a working plugin is this: Code:
db = self.gui.library_view.model().db book_authors = db.authors(book_id, index_is_id=True) If I want to create that gui db object in a commandline session (either interactive or in a script.py file) so I can poke around a little (viewing only) what do I need to do? I've seen the calibre-debug -e myscript.py option in the user manual but I'm not sure how to access the gui data. Secondly, if the above is possible I would also like to look around the available data when a device is connected (self.gui.device_manager.connected_device when used in a plugin). In case it's relevant, I don't have any development environment - just my trusty text editor (Notepad++) |
10-25-2012, 01:04 PM | #2 |
creator of calibre
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre-debug -c "from calibre.library import db; db = db(); Do whatever with the db object"
For device access, you can directly instaantiate the device plugin, like this calibre-debug -c "from calibre.customize.builtins import PRS505; device = PRS505(None)" |
Advert | |
|
10-25-2012, 01:59 PM | #3 |
Grand Sorcerer
Posts: 6,206
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Many thanks, I'll have a play
|
10-25-2012, 08:26 PM | #4 |
Grand Sorcerer
Posts: 6,206
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
After some playing around I'm OK with the 'db' part of your reply but not the 'device' part. I understand, using your example, that I can do things like
Code:
device=PRS505(None) print(device.EBOOK_DIR_MAIN) e.g within a plugin, if I wanted to know what drive the device was connected as I would use Code:
root_path = self.gui.device_manager.connected_device._main_prefix |
10-25-2012, 11:24 PM | #5 |
creator of calibre
Posts: 43,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Call device.open((1,1,1,'','',''), 'test') then calibre will connect to the device and you will be able to interrogate the device.
|
Advert | |
|
10-26-2012, 09:53 AM | #6 |
Grand Sorcerer
Posts: 6,206
Karma: 16228558
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Thank you, that works. The fog is lifting...
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre is not viewing Arabic text | ahmed_rdi | Calibre | 3 | 10-19-2011 04:42 AM |
deleting old news via commandline?! | gdm11 | Calibre | 1 | 06-12-2011 07:33 PM |
PRS-650 First Checkout from Overdrive - Viewing in Calibre? | ArmadilloPilot | Sony Reader | 5 | 02-18-2011 02:00 PM |
Series data usage, and GUI manipulations? | DSchaper | Calibre | 1 | 01-17-2011 08:10 PM |
Commandline only build | plord | Calibre | 11 | 11-27-2010 06:56 PM |