Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 11-17-2015, 01:32 PM   #1
Ephemerality
Addict
Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.
 
Posts: 328
Karma: 800105
Join Date: Feb 2013
Device: PW1
Sending additional files to Kindle

Hi there,
I'm looking for a bit of plugin advice as I'm unsure as to what the best option might be. I have a standalone application that generates Kindle X-Rays and other misc files. My ultimate goal is to have the "send to device" option also send the .asc files when it sends the book and apnx file (which I now realize is generated within the device driver itself).
I was hoping to simply save them in the same location as the book file but after much fiddling I discovered that the device driver has no method of accessing the original path of the book it is sending, so it is unable to scan for/send any additional files from that path.
My plan B ideas are either:
  • Hook into the 'send to device' process before the book is copied to the temp location and save the path somewhere the driver can access (requires no configuration but is messy/unsafe/unreliable?)
  • Add a setting to specify the path to the X-Ray Builder output directory and scan/send files from there (is there an option to add a folder-chooser to the plugin preferences dialog?) -- requires minor config, thus less ideal, but if it works it works...
Any thoughts?

Thanks

Last edited by Ephemerality; 11-17-2015 at 01:34 PM.
Ephemerality is offline   Reply With Quote
Old 11-17-2015, 02:58 PM   #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,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
There is no really clean solution for this. The device subsystem assumes that book == single file. Changing that would require changes in the guts of calibre's devices subsystem.


The cleanest approach I can come up with is to have your plugin simply add the data to an existing azw3 file as a new record type, XRAY, see for example, the SRCS record in kindlegen produced files. Then the driver can look for this record and extract the info in it into the asc file the kindle needs when sending.

Unfortunately, this will require you to write code to modify existing mobi/azw3 files and add a record to them. That is not exactly trivial.

A more hackish solution is to create an altogether new filetype, say .xray which is basically a zip file containing the original azw3 and the xray information. Then the driver could be modified as before to extract both the xray and the azw3 files during send. The downsides to this are data duplication -- the book will be present twice in the book record and you would also need to write simple wrappers to read/write metadata from the new xray files in calibre.

Regarding your suggestions:

1) Is really not safe since the driver runs in a separate thread from the rest of calibre and is not supposed to be accessing the calibre library at all

2) You can certainly do this, plugins can have arbitrarily complex configuration. But it will be somewhat hard to use for your plugin users.
kovidgoyal is offline   Reply With Quote
Old 11-17-2015, 05:16 PM   #3
Ephemerality
Addict
Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.
 
Posts: 328
Karma: 800105
Join Date: Feb 2013
Device: PW1
I was afraid of that. I'd rather not make any changes to users' books but it does seem like the cleanest approach given the limitations of the device driver. The X-Ray files can also be somewhat large (1MB for A Game of Thrones, a 3MB eBook file, uncompressed at least).

I like the concept of your second idea, but the duplication is a definite downside.
I'll have to give it some more thought and decide which would make the most sense.

If I simply go with my second option, is there a generic file-chooser dialog that I can use when I set up my preferences or would I need to create a new dialog class (so the user can select the path to my program)?

Thanks for your input!

Last edited by Ephemerality; 11-17-2015 at 05:19 PM.
Ephemerality is offline   Reply With Quote
Old 11-17-2015, 09:17 PM   #4
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,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
calibre.gui2.choose_files
kovidgoyal is offline   Reply With Quote
Old 11-18-2015, 01:19 AM   #5
Ephemerality
Addict
Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.Ephemerality ought to be getting tired of karma fortunes by now.
 
Posts: 328
Karma: 800105
Join Date: Feb 2013
Device: PW1
Excellent, thank you.
Ephemerality is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send to additional files to Kindle... darrenmcg Library Management 1 03-30-2015 04:30 AM
Small Problem With Calibre Sending Files To Android Kindle quasarpod Devices 3 10-01-2011 11:18 AM
Metadata corrupt when sending files to free.kindle.com olgs Amazon Kindle 2 09-03-2011 02:54 AM
Sending multiple files to kindle 2 Bonanza43 Calibre 2 07-29-2011 02:07 PM
Sending files to different kindle devices lunichka Calibre 3 07-19-2011 04:07 PM


All times are GMT -4. The time now is 05:25 AM.


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