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-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: 649
Karma: 2018502
Join Date: Jan 2013
Location: New Brunswick, Canada
Device: Kobo Glo
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,097
Karma: 8671315
Join Date: Dec 2006
Location: Singapore
Device: Coolreader(Nexus 5)\Coolreader(Nook Touch)
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: 25,905
Karma: 5035037
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
"chaley", not "charley"
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: 5,391
Karma: 821638
Join Date: Jan 2010
Location: France
Device: Many android devices
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
Grand Sorcerer
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: 14,607
Karma: 5628865
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
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: 649
Karma: 2018502
Join Date: Jan 2013
Location: New Brunswick, Canada
Device: Kobo Glo
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:37 AM.


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