11-06-2018, 09:34 PM | #1 |
Wizard
Posts: 2,758
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
Help developing kepubify plugin for calibre
I've been working on a kepubify plugin for calibre. Here is what I have so far: https://github.com/geek1011/kepubify...re/__init__.py . This is my first plugin (and I also don't even use calibre much), so feel free to be truthful about how bad it is so far .
It kinda works so far, but it's a bit flakey (it fails randomly). Also, note that to build this plugin, you need to download all the kepubify executables from the releases page into the plugin dir. My main questions are: 1. How can I prevent this from conflicting with the other kepub output plugin? 2. Why does the executable extraction fail randomly, and is there a way I can only extract it once during installation (or per startup, instead of per book)? 3. How does my code look so far (note that I still need to add the conversion options)? |
11-19-2018, 06:18 PM | #2 |
Wizard
Posts: 2,758
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
Anyone?
|
11-25-2018, 09:45 PM | #3 |
Groupie
Posts: 159
Karma: 27950
Join Date: Nov 2018
Device: Kobo Aura One, Kobo Forma
|
I just saw this thread, I'll try it soon and will let you know the result.
|
11-25-2018, 09:47 PM | #4 |
Wizard
Posts: 2,758
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
|
11-26-2018, 01:53 AM | #5 | |
Groupie
Posts: 159
Karma: 27950
Join Date: Nov 2018
Device: Kobo Aura One, Kobo Forma
|
I'm not familiar with the Caibre Plugin development, but how can I use your kepubify plugin with Calibre.
From the Preferences->Plugins page, it says I can load plugin from file (zip file), so I downloaded the `kepubify-calibre-plugin.zip` file from github calibre-plugin branch, but Calibre failed to load it and saying Quote:
So, how exactly can I test your kepubify calibre plugin? UPDATE: I got it, I have to put the `kepubify-windows-32bit.exe`(why not check x86 or x64 since you do that for linux in __init__.py file) file into the directory which contains `__init__.py` file and then archive the two files into a zip file, and then load this zip file in Calibre->Pregerences->Plugins page, and it is now successfully installed. I'll test its functions later, since I'm currently in an environment which contains empty Calibre. As for "Conflicts with KePub Output Plugin" problem, I don't know whether you can check if Calibre enables `KePub Output Plugin` already or not and pop a window saying which one to enable. Last edited by codychan; 11-26-2018 at 02:54 AM. |
|
11-26-2018, 08:43 AM | #6 |
Groupie
Posts: 159
Karma: 27950
Join Date: Nov 2018
Device: Kobo Aura One, Kobo Forma
|
update:
I just tried to send two epub files(files size: 158.7MB+147.4MB) to Kobo Forma at one click, once using Kepub output plugin and once using Kepubify output plguin. When I tried one plugin, I uninstalled the other and restarted Calibre. But the time spent is basically the same, 4m5s for Kepub output plugin, 4m4s for Kepubify output plugin. The time consists of both converting epub to kepub and sending the file to Kobo Forma. So Kepubify output plugin is not actually faster? Last edited by codychan; 11-26-2018 at 09:09 AM. |
11-26-2018, 08:46 AM | #7 | |
Wizard
Posts: 2,758
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
Quote:
|
|
11-26-2018, 07:20 PM | #8 | ||
Grand Sorcerer
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
If you want to skip that, and transform an existing epub to kepub, then either create a user interface plugin that runs kepubify and adds the output to the library, or an alternative to the KoboTouchExtended driver that does the transformation during the send-to-device. Note: I use the word "transform" deliberately above to differentiate from a calibre conversion. The conversion can make a lot more changes than what the KoboTouchExtended driver does, and I assume that kepubify does. Quote:
An alternative is what the DOC input plugin does. It needs a MS Word executable and has a configuration option to set the path to the executable. |
||
11-26-2018, 07:28 PM | #9 | |||
Wizard
Posts: 2,758
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
Quote:
Quote:
Quote:
|
|||
11-26-2018, 09:04 PM | #10 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
@geek1011,
I don't know whether this is useful to you or not ... I have a few personal calibre UI plugins which contain 3rd-party executables (e.g. LAME.exe, epubcheck.jar) in their zip file. The technique I have always used for these is to do a one-off extract to a calibre temp directory (during the processing of the first epub) which I know will exist for the duration of the rest of the multi-epub batch looping. The only one that I've published in the calibre Index of Plugins which does this is my 'TTS to MP3' plugin. You could have a look at the code (utils.py/extract_executable) to see whether any of it is useful to you. When exploding-manipulating-rezipping epubs I always use calibre's standard container functions because Kovid's already thought of and solved more potential problems than I could ever think up on my own. (Not only that, but he keeps them all up-to-date without me having to lift a finger ) All exploded epubs in the same batch automatically share the same parent temp directory, so I use this parent as the calibre temp directory to extract the 3rd-party executables to. It also gets auto-deleted when calibre is closed. In addition, FWIW, I have a personal 'Epub to Kepub' calibre UI plugin which uses a QProgressDialog to loop around a selection of calibre epubs, format-shifting to kepub then auto-adding the kepub into the calibre library. I have no intention of ever publishing it because it's designed to satisfy my own kepub whims, not just those included in the KoboTouchExtended driver or in kepubify. Nevertheless, you're more than welcome to have a look if it might be helpful from a general UI plugin POV. |
11-26-2018, 09:09 PM | #11 | ||
Grand Sorcerer
Posts: 24,906
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Obok is a lot simpler but is intended to add a new book from scratch. I can't remember what it does if the book already exists in the library. I have a version of it that doesn't do the DRM removal. I've been meaning to add an option to let it add the book as a kepub instead of epub. At the time someone did the last rewrite of Obok, there wasn't much much point in doing that as the other plugins needed to fully handle kepubs didn't exist. Now, they do and if the kepub is based on epub3, I tend to add it to the library as a kepub as that works better on the Kobo devices. Quote:
|
||
11-26-2018, 09:15 PM | #12 |
creator of calibre
Posts: 43,926
Karma: 22669820
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
To add books to calibre from file paths in a UI plugin, do something like:
Code:
self.iactions['Add Books']._add_books(['/path/to/book/file'], False) |
11-26-2018, 09:33 PM | #13 | |
Wizard
Posts: 2,758
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
Quote:
|
|
11-26-2018, 09:34 PM | #14 |
Wizard
Posts: 2,758
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
|
11-26-2018, 09:35 PM | #15 | |
Wizard
Posts: 2,758
Karma: 6990705
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
|
Quote:
P.S. Can you take a look at my last post in the 4.11.12019 thread? That firmware is really, really unusual. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
kepubify 2.0 - A standalone tool to convert ePubs to Kepubs | geek1011 | Kobo Reader | 149 | 10-03-2020 04:12 PM |
kepubify - A standalone tool to convert ePubs into Kobo ePubs | geek1011 | Kobo Reader | 114 | 03-04-2018 10:30 AM |
Developing plugin to process notes from Sony PRS-T1: no module named | sjvs | Development | 19 | 03-25-2012 11:53 AM |
Difference between emulator and real device (developing uds plugin for djvu) | luite | iRex | 7 | 03-03-2010 08:55 PM |
Developing a plugin on osx 10.5 | macuser15905 | Plugins | 2 | 08-28-2009 03:54 PM |