|
|
#1 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,098
Karma: 3332928
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350/650/T1, PB360, KoboGlo, KoboAuraHD
|
Help viewing calibre gui data via commandline
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++) |
|
|
|
|
|
#2 |
|
Creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 22,513
Karma: 2944574
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)"
__________________
Get calibre Notice to all: I can not provide assistance with DRM removal, for legal reasons, so please do not contact me about it. |
|
|
|
|
Enthusiast
|
|
|
|
#3 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,098
Karma: 3332928
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350/650/T1, PB360, KoboGlo, KoboAuraHD
|
Many thanks, I'll have a play
|
|
|
|
|
|
#4 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,098
Karma: 3332928
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350/650/T1, PB360, KoboGlo, KoboAuraHD
|
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 |
|
|
|
|
|
#5 |
|
Creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 22,513
Karma: 2944574
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.
__________________
Get calibre Notice to all: I can not provide assistance with DRM removal, for legal reasons, so please do not contact me about it. |
|
|
|
|
|
#6 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,098
Karma: 3332928
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350/650/T1, PB360, KoboGlo, KoboAuraHD
|
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 |