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 01-13-2013, 09:06 PM   #1
jgoguen
Generally Awesome Person
jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.
 
Posts: 1,061
Karma: 2178845
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
Driver plugin: get file path of ebook?

Is there a way for a device driver plugin to get the original file path of an ebook, or do I need to open metadata.db and query for the path from there? For example, if I have a book at C:\Users\jgoguen\ebooks\Author\awesomebook.epub and I upload it to my device, the only path I can find how to get with the API is the obfuscated path in a temporary folder. I'm working on a plugin that modifies ePub files in transit and I'd like to be able to save the modified files back to the calibre library and replace the original book.
jgoguen is offline   Reply With Quote
Old 01-13-2013, 09:18 PM   #2
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 jgoguen View Post
Is there a way for a device driver plugin to get the original file path of an ebook, or do I need to open metadata.db and query for the path from there? For example, if I have a book at C:\Users\jgoguen\ebooks\Author\awesomebook.epub and I upload it to my device, the only path I can find how to get with the API is the obfuscated path in a temporary folder. I'm working on a plugin that modifies ePub files in transit and I'd like to be able to save the modified files back to the calibre library and replace the original book.
Have a look at modify epub plugin it modifies the epub and then overwrites the original that might help.
Dopedangel is offline   Reply With Quote
Old 01-13-2013, 10:58 PM   #3
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,844
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No there's no way to get the original file path in a device driver. Device drivers are not supposed to be modifying files in the library. I for one would be pretty annoyed if sending files to a device caused the originals to be changed. Why do you need this capability?
kovidgoyal is offline   Reply With Quote
Old 01-14-2013, 03:13 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Also note that device drivers run on a different thread. Modifying the library in any way from a device driver could lead to very difficult to debug inconsistencies. In addition, the ebook could have been modified by a plugboard before being handed to the device driver. Those modifications must not be made permanent.
chaley is offline   Reply With Quote
Old 01-14-2013, 04:14 AM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,785
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
My 2 cents
Many people don't keep the original source file in the same place (if at all) after import into Calibre, thus making use of any 'logged' 'original path/filename' inconsistent on further usage at best
theducks is offline   Reply With Quote
Old 01-14-2013, 07:27 AM   #6
jgoguen
Generally Awesome Person
jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.jgoguen ought to be getting tired of karma fortunes by now.
 
Posts: 1,061
Karma: 2178845
Join Date: Jan 2013
Location: /dev/kmem
Device: Kobo Clara HD, Kindle Oasis
Quote:
Originally Posted by chaley View Post
In addition, the ebook could have been modified by a plugboard before being handed to the device driver.
I forgot all about metadata plugboards. Thank you for pointing this out, I won't bother with this since you're right, this could likely lead to things that users wouldn't want or expect to be saved back to the library.

Quote:
Originally Posted by kovidgoyal View Post
Why do you need this capability?
It's more of something that I personally would like to have the option for. The driver plugin I'm working on modifies the contents of ePub files (adds extra span tags to allow annotation saving and last read position saving to work better) before sending them to the device and I'd prefer to not have to re-parse the files on the occasional times where I re-upload a book for some reason.

If the intention is that a driver plugin should never actually do this I won't bother, I can accomplish the same thing by removing the calibre book and saving from the device into my library.

Last edited by jgoguen; 01-14-2013 at 07:31 AM. Reason: Missed an important post
jgoguen is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get the file path of the ebook in the frontmost Ebook Viewer window johnsidi Development 1 07-16-2012 10:37 AM
User Defined device plugin - path scubaman Devices 1 12-22-2011 11:44 AM
[Device Interface Plugin] Update for Nook Color Driver jmricker Plugins 0 10-22-2011 10:11 AM
Driver Plugin not rekognized silentguy Plugins 2 12-01-2010 12:14 PM
Remove file path from PDF file DuckDodgers PDF 1 08-13-2006 09:23 AM


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


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