08-16-2018, 01:31 AM | #1 |
Member
Posts: 18
Karma: 10
Join Date: Mar 2018
Device: Kindle
|
Trouble writing plugin to save MOBI files
I'm working on a plug-in that includes the option to save the currently selected books as MOBI files to a specific location that varies depending on the book's tags.
I'm having trouble figuring out what class will actually do the save. Is that the SaveToDiskAction class? If so, what are the parameters that it wants? Thank you |
08-16-2018, 02:50 AM | #2 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You dont need to use any class to do this. Simply use the copy_format_to() function of the database to do it. The database api is documented in the user manual.
|
08-16-2018, 01:27 PM | #3 |
Member
Posts: 18
Karma: 10
Join Date: Mar 2018
Device: Kindle
|
Oh that's great, thank you.
I've got it working as long as I specify a full path to the destination file name. If I give it just a path – path="/Users/wanderer/Desktop" – it throws an error, complaining that I've only given it a path. I see from the docs that this should work. Am I doing something wrong? I'm on a Mac. The error it's giving is: IOError:[Errno 21] Is a directory: u'/Users/wanderer/Desktop' Thanks! |
08-16-2018, 02:29 PM | #4 |
Member
Posts: 18
Karma: 10
Join Date: Mar 2018
Device: Kindle
|
Also, I need to be about to write out the cover to a JPEG file.
|
08-16-2018, 06:24 PM | #5 |
Member
Posts: 18
Karma: 10
Join Date: Mar 2018
Device: Kindle
|
Whoops! Silly me, there's a copy_cover_to method right there. Sorry about that.
|
08-20-2018, 12:36 AM | #6 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The docs say you can use a path, by which they mean a path to a file, not a path to a directory.
|
Tags |
plugin, save_to_disk, saving |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] QuickPrefsEdit - Edit plugin prefs json files. | slowsmile | Plugins | 3 | 07-25-2018 08:14 PM |
How to save MOBi files to my device | clelia | Calibre | 2 | 03-21-2015 06:03 AM |
When I Save a MOBI Book 3 Different Files Show Up...WHY? | Nalapombu | Devices | 1 | 09-03-2012 03:07 AM |
How to access all identifier when writing mobi files? | siebert | Calibre | 16 | 07-08-2011 05:02 PM |
Download and save MOBI files to Kindle over 3g? | guiyoforward | Amazon Kindle | 4 | 09-19-2010 10:56 AM |