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 08-16-2018, 02:31 AM   #1
wrench100
Member
wrench100 began at the beginning.
 
Posts: 12
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
wrench100 is offline   Reply With Quote
Old 08-16-2018, 03:50 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: 33,747
Karma: 10215946
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.
kovidgoyal is offline   Reply With Quote
Old 08-16-2018, 02:27 PM   #3
wrench100
Member
wrench100 began at the beginning.
 
Posts: 12
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!
wrench100 is offline   Reply With Quote
Old 08-16-2018, 03:29 PM   #4
wrench100
Member
wrench100 began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Mar 2018
Device: Kindle
Also, I need to be about to write out the cover to a JPEG file.
wrench100 is offline   Reply With Quote
Old 08-16-2018, 07:24 PM   #5
wrench100
Member
wrench100 began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Mar 2018
Device: Kindle
Whoops! Silly me, there's a copy_cover_to method right there. Sorry about that.
wrench100 is offline   Reply With Quote
Old 08-20-2018, 01:36 AM   #6
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: 33,747
Karma: 10215946
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.
kovidgoyal is offline   Reply With Quote
Reply

Tags
plugin, save_to_disk, saving

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] QuickPrefsEdit - Edit plugin prefs json files. slowsmile Plugins 3 07-25-2018 09:14 PM
How to save MOBi files to my device clelia Calibre 2 03-21-2015 07:03 AM
When I Save a MOBI Book 3 Different Files Show Up...WHY? Nalapombu Devices 1 09-03-2012 04:07 AM
How to access all identifier when writing mobi files? siebert Calibre 16 07-08-2011 06:02 PM
Download and save MOBI files to Kindle over 3g? guiyoforward Amazon Kindle 4 09-19-2010 11:56 AM


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


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