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 01-07-2012, 05:39 AM   #1
srv1973
Junior Member
srv1973 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2012
Device: Nook Color with CM7
Custom Device plugin for Nook Color with CM7 & Aldiko

Hi all,

I've got a Nook Color, running CyanogenMod 7, and I use Aldiko as my preferred e-Book reader. The integration with Calibre is, well, not ideal. Before I flashed CM on my Nook, I used the standard B&N software (but rooted), and I loved the way Calibre completely transparently uploaded (side-loaded?) my ebooks into the B&N Reader app.

I'm considering putting some time into trying to make this seamless on my current setup as well. In order to make that happen, I need to do (as far as I can tell after just a little bit of investigation) the following:
  1. Make Calibre detect my Nook Color is very specifically a "Nook Color running CM7 and has Aldiko installed"
  2. Copy/etc ebooks to/from the standard Aldiko library location
  3. Access the Aldiko library.db file and reflect changes to files

I think I can manage (2) and (3), I inspected the structure of the Aldiko library database and it doesn't look particularly difficult. That'll help with detecting whether Aldiko is installed or not as well.

I'm not sure however how to create a new Device plugin that detects this is "nook color with CM rom and aldiko". I think it's not really possible to base this based on PRODUCT_ID and BCD... Without really understanding how Calibre gets these values, based on the output of the "Debug Device Detection" and looking at the source of the NOOK_COLOR class those values appear to be the same as for a 'standard Nook Color'.

Anybody can give me some pointers on how to subclass the existing NOOK_COLOR class to my specific setup, and how to make the device detection work for this?
srv1973 is offline   Reply With Quote
Old 01-07-2012, 05:51 AM   #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,775
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I suggest you create a custom plugin, disable the builtin one via Preferences->Plugins, then your custom one will always get matched against those USD ids.
kovidgoyal is offline   Reply With Quote
Advert
Old 01-07-2012, 06:09 AM   #3
srv1973
Junior Member
srv1973 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2012
Device: Nook Color with CM7
Quote:
Originally Posted by kovidgoyal View Post
I suggest you create a custom plugin, disable the builtin one via Preferences->Plugins, then your custom one will always get matched against those USD ids.
OK, that would be a good (if somewhat dirty) hack It certainly would serve my purpose. However, I think that more people might be interested in this setup, so for the future something more automatic might be desired.

Rgds
srv1973 is offline   Reply With Quote
Old 01-07-2012, 06:13 AM   #4
srv1973
Junior Member
srv1973 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2012
Device: Nook Color with CM7
On a more general level: how can I add a device plugin to Calibre without adding it to the pylib.zip file (eg without setting up a complete development environment)? Seems to me this should be possible, but how?
srv1973 is offline   Reply With Quote
Old 01-07-2012, 06:47 AM   #5
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,775
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Look under the tutorials section of the user manual, there is a tutorial on how to write plugins for calibre. If other people want to use your plugin, they can do so, the same way as you would use it - disable builtin and install your plugin.
kovidgoyal is offline   Reply With Quote
Advert
Old 01-08-2012, 03:21 AM   #6
Dopedangel
Wizard
Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.Dopedangel ought to be getting tired of karma fortunes by now.
 
Dopedangel's Avatar
 
Posts: 1,759
Karma: 30063305
Join Date: Dec 2006
Location: Singapore
Device: Boyue
Quote:
Originally Posted by srv1973 View Post
Hi all,

I've got a Nook Color, running CyanogenMod 7, and I use Aldiko as my preferred e-Book reader. The integration with Calibre is, well, not ideal. Before I flashed CM on my Nook, I used the standard B&N software (but rooted), and I loved the way Calibre completely transparently uploaded (side-loaded?) my ebooks into the B&N Reader app.

I'm considering putting some time into trying to make this seamless on my current setup as well. In order to make that happen, I need to do (as far as I can tell after just a little bit of investigation) the following:
  1. Make Calibre detect my Nook Color is very specifically a "Nook Color running CM7 and has Aldiko installed"
  2. Copy/etc ebooks to/from the standard Aldiko library location
  3. Access the Aldiko library.db file and reflect changes to files

I think I can manage (2) and (3), I inspected the structure of the Aldiko library database and it doesn't look particularly difficult. That'll help with detecting whether Aldiko is installed or not as well.

I'm not sure however how to create a new Device plugin that detects this is "nook color with CM rom and aldiko". I think it's not really possible to base this based on PRODUCT_ID and BCD... Without really understanding how Calibre gets these values, based on the output of the "Debug Device Detection" and looking at the source of the NOOK_COLOR class those values appear to be the same as for a 'standard Nook Color'.

Anybody can give me some pointers on how to subclass the existing NOOK_COLOR class to my specific setup, and how to make the device detection work for this?
Your plugin would be useful to a lot of android phones and aldiko users so I think you would be better off making a plugin that sets the uuid in the user defined usb plugin and make modifications to that so when it detects an aldiko database it works with that.
Dopedangel is offline   Reply With Quote
Old 01-08-2012, 11:06 AM   #7
srv1973
Junior Member
srv1973 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2012
Device: Nook Color with CM7
Quote:
Originally Posted by kovidgoyal View Post
Look under the tutorials section of the user manual, there is a tutorial on how to write plugins for calibre. If other people want to use your plugin, they can do so, the same way as you would use it - disable builtin and install your plugin.
I don't think this works for Device Drivers. I created a zip file called "nook_cm7.zip" that contains:

__init__.py (empty file)
driver.py, contains:

from calibre.devices import NOOK_COLOR

class NOOK_COLOR_CM7 (NOOK_COLOR):
name = 'Nook Device Interface with CM7'
gui_name = _('The Nook Color with CM7')
description = _('Communicate with Nook Color running CM7.')

I'm trying to load this into Calibre with:

Preferences->Advanced->Plugins->Load Plugin from File

and I get:

calibre, version 0.8.33
ERROR: Unhandled exception: <b>InvalidPlugin</b>:No plugin class found in C:/Maarten/Src/calibre/nook_cm7.zip:dummy1

Traceback (most recent call last):
File "site-packages\calibre\gui2\preferences\plugins.py", line 292, in add_plugin
File "site-packages\calibre\customize\ui.py", line 339, in add_plugin
File "site-packages\calibre\customize\ui.py", line 54, in load_plugin
File "site-packages\calibre\customize\zipplugin.py", line 177, in load
InvalidPlugin: No plugin class found in C:/Maarten/Src/calibre/nook_cm7.zip:dummy1

So, how do I write/test a Device Driver without setting up an entire development environment for Calibre?

[edit] OK, got it working. Apparently there's a naming convention for the zip file and the .py file inside. I used the Medion OYO driver plugin from here as an example, and can now load my "driver".

Last edited by srv1973; 01-08-2012 at 12:44 PM. Reason: Spoke too soon
srv1973 is offline   Reply With Quote
Old 01-08-2012, 11:09 AM   #8
srv1973
Junior Member
srv1973 began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2012
Device: Nook Color with CM7
Quote:
Originally Posted by Dopedangel View Post
Your plugin would be useful to a lot of android phones and aldiko users so I think you would be better off making a plugin that sets the uuid in the user defined usb plugin and make modifications to that so when it detects an aldiko database it works with that.
I'd love to, but I've never written a plugin or device driver for Calibre before, and I'm also pretty new to Python (but have quite a bit of development experience in other languages), so I'd appreciate any pointers people can throw my way.

Perhaps somebody would like to cooperate? I think I can fairly easily contribute the code required to access the Aldiko library database file, and it'll go quicker if somebody could point me to the correct 'code framework' that this would need to fit in for a Calibre device driver.

[edit] OK, did some tests locally with accessing the Aldiko database file, and as I thought it's pretty trivial to work with. In order to integrate this all nicely in a generic way into Calibre however is something I'm going to need a lot of pointers and help with. If there is any interested from the developers for this, please contact me.

Rgds

Last edited by srv1973; 01-08-2012 at 01:41 PM.
srv1973 is offline   Reply With Quote
Old 01-09-2012, 03:45 AM   #9
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,775
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Can you send me an email (my email address is all over the calibre source) and I will try to help you get going with setting up a device plugin. Once your plugin has reached maturity, and been tested by a few people, we can look into integrating it into calibre so that it is used automatically.
kovidgoyal 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
Nook Color with Rooted Cm7 sd card verna2197 Barnes & Noble NOOK 6 12-16-2011 08:22 PM
Color Nook Color - Process to move from CM7.0.3 on SD to CM7.1 in emmc? scarab1 Nook Developer's Corner 4 11-02-2011 01:32 PM
[Device Interface Plugin] Update for Nook Color Driver jmricker Plugins 0 10-22-2011 10:11 AM
Color I have CM7 on my nook color and now what??? skydive Nook Developer's Corner 13 08-31-2011 07:01 AM
Nook Color 1.2.0 - Want to Root Latest CM7 to SD lennyb Nook Developer's Corner 3 08-09-2011 02:12 AM


All times are GMT -4. The time now is 12:10 PM.


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